C++ Template Metaprogramming
Solutions to the exercises throughout the book
Loading...
Searching...
No Matches
chapter7::least_refined_iterator_category< S > Struct Template Reference

Assuming a sequence of sequences, find the least refined category of all subsequences. More...

#include <chapter-7-zip_view.hpp>

Public Types

typedef boost::mpl::filter_view< S, boost::mpl::not_< boost::is_same< extract_iterator_category< _1 >, boost::mpl::random_access_iterator_tag > > >::type non_random_access_iterators
 Show us everything that is not categorized as "random access.".
 
typedef boost::mpl::filter_view< non_random_access_iterators, boost::mpl::not_< boost::is_same< extract_iterator_category< _1 >, boost::mpl::bidirectional_iterator_tag > > >::type non_bidirectional_iterators
 Show us everything that is not categorized as either "bidirectional" OR "random access.".
 
typedef boost::mpl::if_< boost::mpl::empty< non_random_access_iterators >, boost::mpl::random_access_iterator_tag, typenameboost::mpl::if_< boost::mpl::empty< non_bidirectional_iterators >, boost::mpl::bidirectional_iterator_tag, boost::mpl::forward_iterator_tag >::type >::type type
 

Detailed Description

template<typename S>
struct chapter7::least_refined_iterator_category< S >

Assuming a sequence of sequences, find the least refined category of all subsequences.

Basically, if we have nothing but random access, return that. If we have nothing but random access or bidirectional, return bidirectional, and if we have anything else, just return forward_iterator_tag.

In the case that we have random_access iterators, this should be pretty stingy with its template instantiations. If there are nothing but forward_iterator types, though, this will probably be a bit worse than a more eager approach.

Template Parameters
SThe sequence of sequences.

Definition at line 63 of file chapter-7-zip_view.hpp.

Member Typedef Documentation

◆ non_bidirectional_iterators

template<typename S >
typedef boost::mpl::filter_view<non_random_access_iterators,boost::mpl::not_<boost::is_same<extract_iterator_category<_1>,boost::mpl::bidirectional_iterator_tag>>>::type chapter7::least_refined_iterator_category< S >::non_bidirectional_iterators

Show us everything that is not categorized as either "bidirectional" OR "random access.".

Definition at line 84 of file chapter-7-zip_view.hpp.

◆ non_random_access_iterators

template<typename S >
typedef boost::mpl::filter_view<S,boost::mpl::not_<boost::is_same<extract_iterator_category<_1>,boost::mpl::random_access_iterator_tag>>>::type chapter7::least_refined_iterator_category< S >::non_random_access_iterators

Show us everything that is not categorized as "random access.".

Definition at line 73 of file chapter-7-zip_view.hpp.

◆ type

template<typename S >
typedef boost::mpl::if_<boost::mpl::empty<non_random_access_iterators>,boost::mpl::random_access_iterator_tag,typenameboost::mpl::if_<boost::mpl::empty<non_bidirectional_iterators>,boost::mpl::bidirectional_iterator_tag,boost::mpl::forward_iterator_tag>::type>::type chapter7::least_refined_iterator_category< S >::type

Definition at line 93 of file chapter-7-zip_view.hpp.


The documentation for this struct was generated from the following file: