|
Boost Users : |
From: Eric Lemings (lemings_at_[hidden])
Date: 2006-07-18 18:58:04
Giving the following code:
#include <boost/mpl/integral_c.hpp>
namespace mpl = boost::mpl;
template < unsigned U, int I = 1 >
struct T : mpl::integral_c< unsigned, U > {
BOOST_STATIC_CONST(int, N = I);
};
and two vectors of type T of varying lengths:
typedef mpl::vector < T<0>, T<1>, T<2> > t1;
typedef mpl::vector < T<2, 2>, T<0, 0> > t2;
How would you create a joint view of t1 and t2, sorted by increasing U
values, where all elements of t1 and t2 that have the same U value have
their N constants added together.
In the example above, the resulting type t0 would be equivalent to:
typedef mpl::vector < T<0, 1>, T<1, 1>, T<2, 3> > t0;
Thanks,
Eric.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net