|
C++ Template Metaprogramming
Solutions to the exercises throughout the book
|
Encapsulate solution for Exercise 4-5. More...
Functions | |
| template<typename Container , typename Value > | |
| boost::mpl::if_< boost::is_const< Container >, typenameContainer::const_iterator, typenameContainer::iterator >::type | container_find (Container &c, Value const &v) |
Executes std::find across an entire container. | |
Encapsulate solution for Exercise 4-5.
| boost::mpl::if_< boost::is_const< Container >, typenameContainer::const_iterator, typenameContainer::iterator >::type exercise_4_5::container_find | ( | Container & | c, |
| Value const & | v | ||
| ) |
Executes std::find across an entire container.
This method is specially designed to return a const_iterator if the container instance is constant, and non-const otherwise.
| Container | The input container type. |
| Value | A value type suitable for the std::find algorithm when used with Container type containers. |
| [in] | c | The container to search. |
| [in] | v | The value to search for. |
v. The type is dynamically selected based on the container type. Definition at line 70 of file exercise-4-5.hpp.