C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
exercise-3-4.hpp
Go to the documentation of this file.
1// ===-- chapter-3/exercise-3-4.hpp ----------------------- -*- C++ -*- --=== //
9#ifndef EXERCISE_3_4
10#define EXERCISE_3_4
11
12#include "chapter-3-twice.hpp"
13
14#include <boost/static_assert.hpp>
15
16#include <boost/type_traits/add_pointer.hpp>
17
18#include <boost/mpl/equal.hpp>
19#include <boost/mpl/placeholders.hpp>
20using namespace boost::mpl::placeholders;
21
22
35namespace exercise_3_4 {
36using namespace chapter3;
37
39typedef twice<
40 boost::add_pointer<_1>,
43
45 boost::mpl::equal< double_twice, int**** >::type::value));
46
47} // namespace exercise_3_4
48
49#endif // EXERCISE_3_4
Define the twice metafunction for use in multiple exercises.
Provide utilities availble to all Chapter 3 solutions.
Encapsulate solution for Exercise 3-4.
BOOST_STATIC_ASSERT((boost::mpl::equal< double_twice, int **** >::type::value))
twice< boost::add_pointer< _1 >, twice< boost::add_pointer< _1 >, int >::type >::type double_twice
Call twice on itself to add four pointers to a type.
Apply a metafunction to its own result.