
Hi Dave, I believe I found some problem, when I was writing the test cases ;) It is for sure responsible for the reported misbehavior with max_element. Well, I don't know how to deal with this issue, may be you can advice smth. Map accepts sequence of type pair. Vector as well. My approach was to think, as long as mpl::pair static interface (first, second) is valid I can use another class as well. So I decided to derive a public class from mpl::pair, which will model discriminated value int value speciefies a type: template<int N, class T> struct my_pair : mpl::pair<mpl::int_<N>, T> { //some forward declarations of mpl::pair typedefs typename second second_; }; now I could define a map of types using my_pair and avoid using mpl::int_<N> each time: typedef mpl::map<my_pair<0, int>, my_pair<1, double> ...> my_map; Now to the problem :) : mpl::map converts these types to mpl::pair from my_pair. And the code like this will fail: typedef mpl::max_element < mpl::transform_view < my_map , mpl::sizeof_<mpl::_> > >::type max_iter; because mpl::_ is not my_pair, but mpl::pair<X,Y> and has the size of 1 byte ;) (as specified in standard) I understand I can pass to mpl::sizeof_<mpl::_> the second type from, but this would bring the entire forward sequence handling scenario out of the balance. I can use mpl::vector in this example and it will return my_pair, but I can not use mpl::map with custom pair. What should I do? This example shows that vector and map behave differently and I can not fully apply the ForwardSequence abstraction without worring which type was passed. I think with mpl::for_each happens the same thing in my example, but I would like to investigate it more to make conclusions. With Kind Regards, Ovanes Markarian On Thu, December 14, 2006 04:38, David Abrahams wrote:
"Ovanes Markarian" <om_boost@keywallet.com> writes:
Dave,
Thanks for your answers. Can you point me to the docs, how I should organize the test cases?
There are no docs on that; please just look at libs/mpl/test and follow the same patterns.
Should these be some sort of BOOST_STATIC_ASSERTS etc.
I think I could easily extract some code parts and do it.
Thank you
-- Dave Abrahams Boost Consulting www.boost-consulting.com
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users