C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
exercise-3-3.hpp
Go to the documentation of this file.
1// ===-- chapter-3/exercise-3-3.hpp ----------------------- -*- C++ -*- --=== //
9#ifndef EXERCISE_3_3
10#define EXERCISE_3_3
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_3 {
36using namespace chapter3;
37
41 boost::mpl::equal< double_pointer_int, int** >::type::value));
42
47 boost::mpl::equal< four_pointer_int, int**** >::type::value));
48
49} // namespace exercise_3_3
50
51#endif // EXERCISE_3_3
Define the twice metafunction for use in multiple exercises.
Provide utilities availble to all Chapter 3 solutions.
Encapsulate solution for Exercise 3-3.
BOOST_STATIC_ASSERT((boost::mpl::equal< double_pointer_int, int ** >::type::value))
twice< boost::add_pointer< _1 >, int >::type double_pointer_int
Used twice to add two pointers.
twice< boost::add_pointer< _1 >, double_pointer_int >::type four_pointer_int
Used twice twice to add four pointers.
Apply a metafunction to its own result.