Well, the Boost preprocessor metaprogramming library is definitely very useful, but I think your example is imho a bit unfortunately chosen and boost isn't the right thing for this. You'll get bloated code and you have a upper limit of arguments. And it's hard to read. ;)
Why not use the following for this task?
class toStrings { list<string> l; public: template <typename Typ> toStrings operator+(Typ obj) { l.push_back(lexical_cast<string>(obj)); return *this; } list<string> get(){return l;} };
list<string> foo = (toStrings()+"hello"+"world"+42+'h'+123.45f).get();
Recent comments
4 weeks 3 days ago
7 weeks 9 hours ago
7 weeks 4 days ago
8 weeks 9 hours ago
8 weeks 9 hours ago
8 weeks 9 hours ago
9 weeks 5 days ago
10 weeks 5 days ago
12 weeks 6 days ago
12 weeks 6 days ago