C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
Solution to Exercise 2-0. More...
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
Go to the source code of this file.
Classes | |
struct | exercise_2_0::no_boost::add_const_ref_impl< T, IsRef > |
The default implementation adds a const& to the template type. More... | |
struct | exercise_2_0::no_boost::add_const_ref_impl< T, true > |
Simply return the original type if we're already a reference type. More... | |
struct | exercise_2_0::no_boost::add_const_ref< T > |
This is a home-grown implementation to the problem. More... | |
struct | exercise_2_0::no_boost::add_const_ref< T & > |
Partial specialization for when T is already a reference. More... | |
struct | exercise_2_0::no_boost::add_const_ref< T const > |
(Paranoia) Strip off const on T const to avoid T const const& . Not required. More... | |
struct | exercise_2_0::with_boost::add_const_ref< T > |
Boost MPL implementation. More... | |
struct | exercise_2_0::add_const_ref< T > |
A unary metafunction that returns T if it is a reference type, and otherwise returns T const& . More... | |
Namespaces | |
namespace | exercise_2_0 |
Encapsulate solution for Exercise 2-0. | |
namespace | exercise_2_0::no_boost |
Contains a set of solutions implemented without the aid of the Boost MPL. | |
namespace | exercise_2_0::with_boost |
Contains a set of solutions implemented with Boost MPL. | |
Solution to Exercise 2-0.
Definition in file exercise-2-0.hpp.