i try to find a solution for eliminating all duplicates of types in a
non-integral sequence.
the only extisting solution i found has a set< > as output, but i want
to keep the sequence type.
the following code _should_ solve the problem, but there seems to be
something wrong with it.
if someone has an idea...
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace boost::mpl;
struct E {};
struct F {};
struct G {};
struct H {};
int main(int argc, char* argv[]) {
typedef vector< E, E, F, E, G, H, G, G, F, G >::type with_duplicates;
typedef fold< with_duplicates, empty_sequence, if_< contains< _1,
_2 >::type, _1, joint_view< _1, single_view< _2 >::type >::type >::type
::type without_duplicates;
BOOST_MPL_ASSERT_RELATION(size::value, ==, 10);
BOOST_MPL_ASSERT_RELATION(size::value, ==, 4);
return 0;
}
much thanks in advance,
karl