[Home]CPPTM Answers - Exercise 3-2

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

Difference (from prior major revision) (no other diffs)

Changed: 1c1,26

// (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/multiplies.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::multiplies<_1, _1> >::type v2;
typedef mpl::vector_c<int, 1, 4, 9> expected;


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


return 0;
}


// (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/multiplies.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::multiplies<_1, _1> >::type v2;
     typedef mpl::vector_c<int, 1, 4, 9> 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 June 6, 2007 6:40 am (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers