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

Implement rotate_view sequence view. More...

Files

file  exercise-7-3.hpp
 Solution to Exercise 7-3.
 

Namespaces

namespace  test_7_3
 Tests functionality from Exercise 7-3.
 
namespace  exercise_7_3
 Encapsulate solution for Exercise 7-3.
 

Detailed Description

Implement rotate_view sequence view.

7-3. Use mpl::joint_view to implement a rotate_view sequence view,
     presenting a shifted and wrapped view onto the original sequence:

typedef mpl::vector_c<int,5,6,7,8,9,0,1,2,3,4> v;
typedef rotate_view<
    v,
    mpl::advance_c<mpl::begin<v>::type,5>::type
> view;

BOOST_STATIC_ASSERT((
    mpl::equal<
    view, mpl::range_c<int,0,10>
>::value ));