Problems with mpl::push_back

#include

Joaquín M López Muñoz wrote:
Hi Joaquín, The code above doesn't compile because 'list', although being an extensible sequence, does not support O(1) insertion/removal of elements at the end - only at the beginning. Please see http://www.boost.org/libs/mpl/doc/ref/Reference/list.html. Having said that, I should also mention that there is a mismatch between the docs and the code specifically related to 'push_back' - namely, if in the above example you replace 'list' with 'vector', it still won't compile, contrary to what is said on the vector's reference page. This is a known issue. Basically, currently 'vector's characteristics _as an extensible sequence_ are the same as these of the 'list'; of course, it's still a random access sequence - the docs don't lie here :). It's going to be fixed in the next release; the new 'vector' implementation is going to provide constant time insertion at both ends, giving you both 'push_front' _and_ 'push_back'. Meanwhile, please bear with us :). HTH, Aleksey
participants (2)
-
Aleksey Gurtovoy
-
joaquintides