17#define BOOST_TEST_MODULE Utility test
18#define BOOST_TEST_MAIN
19#define BOOST_TEST_DYN_LINK
20#include <boost/test/unit_test.hpp>
21#include "../include/Algorithm/mpl_tools.h"
22#include <boost/mpl/size.hpp>
23#include <boost/type.hpp>
24#include <boost/mpl/range_c.hpp>
25#include <boost/mpl/vector.hpp>
26#include <boost/mpl/deref.hpp>
27#include <boost/mpl/for_each.hpp>
28#include <boost/mpl/vector_c.hpp>
29#include <boost/mpl/placeholders.hpp>
30#include <boost/mpl/lambda.hpp>
31#include <boost/mpl/string.hpp>
42namespace bmpl = boost::mpl;
45using knowntypes = bmpl::vector<float, double, long double, short, long>;
48template <
typename Iterator,
typename End,
typename Element,
typename T,
int Count = 0>
50 using type =
typename bmpl::if_<typename std::is_same<Element, T>::type, bmpl::int_<Count>,
52 typename bmpl::deref<Iterator>::type,
56 static const int value = type::value;
59template <
typename End,
typename Element,
typename T,
int Count>
61 using type =
typename bmpl::if_<typename std::is_same<Element, T>::type,
63 bmpl::int_<Count + 1>>
::type;
65 static const int value = type::value;
73 typename bmpl::end<knowntypes>::type,
125 template <
typename T>
128 std::cout <<
v << std::endl;
129 std::cout <<
"is integral: " << std::is_integral<T>::value << std::endl;
135 using types = bmpl::vector<long, float, short, double, float, long, long double>;
136 std::cout << std::endl
137 <<
"checking types:" << std::endl;
145 using number_of_floats =
146 bmpl::fold<types, bmpl::int_<0>, bmpl::if_<std::is_floating_point<_2>, bmpl::next<_1>, _1>>
::type;
148 static_assert(number_of_floats::value == 4,
"inconsistent number of float values in the type definition");
151 std::cout << std::endl
152 <<
"checking first fold:" << std::endl;
157 std::cout << std::endl
158 <<
"checking second fold:" << std::endl;
typename T::value_type wrapped_type
friend std::ostream & operator<<(std::ostream &stream, const Codec &rhs)
friend std::ostream & operator<<(std::ostream &stream, const Model &rhs)
GLsizei GLenum GLenum * types
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
void operator()(const T &v)
typename bmpl::if_< typename std::is_same< Element, T >::type, bmpl::int_< Count >, bmpl::int_< Count+1 > >::type type
typename bmpl::if_< typename std::is_same< Element, T >::type, bmpl::int_< Count >, typename type_index< typename bmpl::next< Iterator >::type, End, typename bmpl::deref< Iterator >::type, T, Count+1 >::type >::type type