Hi Andrey,
you can pass list by value. Compiler should be smart enough to eliminate the temporary.
On the other hand, if you vector is always constant consider using a fusion vector.
You can also introduce a helper function, which fills the vector with the desired list
and returns it:
struct sss
{
sss()
: v(vector_items)
{}
private:
// this function should be inlined with temporary elimination
static vector<int> vector_items()
{
vector<int> v = list_of...;
return v;
}
};
Hope that helps,
Ovanes
On 17 March 2010 17:58, Ovanes Markarian <om_boost@keywallet.com> wrote:I think that result of `list_of` will be destroyed after
> vector<int> v(my_iterator(list_of(1)(2)), my_iterator());
`my_iterator(...)` call, so `my_iterator` will not be valid.
--
Regards, Andrey
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users