On 08/13/2013 11:03 PM, Vicente J. Botet Escriba wrote:
Le 13/08/13 16:09, Adam Romanek a écrit :
I'd like to return a container of non-movables from a function in C++03 with no success.
Boost.Container should be movable independently on whether their elements are movable or not.
Right. I made a mistake in the opening post - I wanted to ask about a container of non-copyables but movables.
nc_vector create() { return nc_vector(); }
I suspect that this is a limitation on the emulation with gcc-4.6.3. Could you try
nc_vector create() { nc_vector res; return boost::move(res); }
This was the first thing I tried. Unfortunately without success. It turned out that the problem is not in returning the container from function but in constructing the other one from it in main(): int main () { nc_vector v(create()); return 0; } The boost::container::vector offers copy-constructor and move-constructor. In C++03 mode the first one is chosen which leads to a compile error. On the other hand with -std=c++0x the latter one is chosen and the code compiles without any problems. One way to workaround the issue is to make the copy-constructor disable_if-ed in case of non-copyable elements in C++03. The copy-constructor is useless in this case so such a change should be safe, right? What do you think about it? WBR, Adam Romanek
Best, Vicente _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users