[Home]CPPTM Answers - Exercise 3-1

BOOST WIKI | RecentChanges | Preferences | Page List | Links List

 // (by Ariel Badichi)
 #include <boost/static_assert.hpp>
 #include <boost/mpl/equal.hpp>
 #include <boost/mpl/vector_c.hpp>
 #include <boost/mpl/transform.hpp>
 #include <boost/mpl/plus.hpp>
 # include <boost/mpl/int.hpp>
 #include <boost/mpl/placeholders.hpp>

 int main()
 {
     namespace mpl = boost::mpl;
     using namespace mpl::placeholders;

     typedef mpl::vector_c<int, 1, 2, 3> v1;
     typedef mpl::transform<v1, mpl::plus<_, mpl::int_<1> > >::type v2;
     typedef mpl::vector_c<int, 2, 3, 4> expected;

     BOOST_STATIC_ASSERT((mpl::equal<expected, v2>::type::value));

     return 0;
 }

BOOST WIKI | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited March 26, 2005 7:51 am (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers