tinympl  0.2
mini MPL library for C++11
all_of.hpp
1 // Copyright (C) 2013, Ennio Barbaro.
2 //
3 // Use, modification, and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://sbabbi.github.io/tinympl for documentation.
8 //
9 // You are welcome to contact the author at:
10 // enniobarbaro@gmail.com
11 //
12 
13 #ifndef TINYMPL_VARIADIC_ALL_OF_HPP
14 #define TINYMPL_VARIADIC_ALL_OF_HPP
15 
16 #include <type_traits>
17 
18 namespace tinympl {
19 namespace variadic {
20 
31 template< template<class ... T> class F, class ... Args> struct all_of;
32 
33 template< template<class ... T> class F, class Head, class ... Args>
34 struct all_of<F, Head, Args...> :
35  std::conditional <
36  F<Head>::type::value,
37  typename all_of<F, Args...>::type,
38  std::integral_constant<bool, false> >::type
39 {};
40 
41 template< template<class ... T> class F> struct all_of<F> :
42  std::integral_constant<bool, true>
43 {};
44 
45 } // namespace variadic
46 } // namespace tinympl
47 
48 #endif // TINYMPL_VARIADIC_ALL_OF_HPP
Determines whether every element in the sequence satisfies the given predicate.
Definition: all_of.hpp:31