C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches

Define a metafunction to add const&. More...

Files

file  exercise-2-0.hpp
 Solution to Exercise 2-0.
 

Namespaces

namespace  exercise_2_0
 Encapsulate solution for Exercise 2-0.
 

Functions

static void anonymous_namespace{chapter-2.cpp}::test_exercise_2_0 ()
 Tests for Exercise 2-0.
 

Detailed Description

Define a metafunction to add const&.

2-0. Write a unary metafunction add_const_ref<T> that returns T if it is a
     reference type, and otherwise returns T const&.  Write a program to test
     your metafunction.  Hint: you can use boost::is_same to test the
     results.

Function Documentation

◆ test_exercise_2_0()

static void anonymous_namespace{chapter-2.cpp}::test_exercise_2_0 ( )
static

Tests for Exercise 2-0.

Definition at line 64 of file chapter-2.cpp.