
On Oct 13, 2013, at 11:44 PM, Michael Marcin
wrote: I pass a mpl::vector with duplicates to mpl::unique and the result still has duplicates. What am I doing wrong?
Just like std::unique, the duplicated elements must be consecutive for mpl::unique to find them. Otherwise the complexity wouldn't be linear.
http://coliru.stacked-crooked.com/a/fe85b5739eb4c15f
#include
#include #include #include #include #include template< typename... Args > void test( const Args&... args ) { using namespace boost::mpl; using namespace boost::mpl::placeholders; typedef vector
args_types; typedef typename unique >::type unique_types; print< unique_types > x; } int main() { int a = 0; char b = 0; test( a, b, a ); }
+ g++-4.8 -std=c++11 -O2 -Wall -pedantic -pthread main.cpp main.cpp: In instantiation of ‘void test(const Args& ...) [with Args = {int, char, int}]’: main.cpp:22:19: required from here main.cpp:15:27: warning: unused variable ‘x’ [-Wunused-variable] print< unique_types > x; ^ + ./a.out
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users