C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
exercise-3-2.hpp
Go to the documentation of this file.
1// ===-- chapter-3/exercise-3-2.hpp ----------------------- -*- C++ -*- --=== //
9#ifndef EXERCISE_3_2
10#define EXERCISE_3_2
11
12#include <boost/mpl/times.hpp>
13#include <boost/mpl/transform.hpp>
14
15#include <boost/mpl/placeholders.hpp>
16using namespace boost::mpl::placeholders;
17
18
32namespace exercise_3_2 {
33
38template <typename T>
39struct ex_3_2 : boost::mpl::transform< T, boost::mpl::times<_1, _1> > { };
40
41} // namespace exercise_3_2
42
43#endif // EXERCISE_3_2
Encapsulate solution for Exercise 3-2.
Given a sequence of numbers, return a sequence of their squares.