Sprout/sprout/tpp/algorithm/all_of.hpp

51 lines
1.1 KiB
C++
Raw Normal View History

2012-10-04 14:25:28 +00:00
#ifndef SPROUT_TPP_ALGORITHM_ALL_OF_HPP
#define SPROUT_TPP_ALGORITHM_ALL_OF_HPP
#include <type_traits>
#include <sprout/config.hpp>
namespace sprout {
namespace tpp {
namespace detail {
2012-11-02 13:00:10 +00:00
template<bool... Values>
2012-10-04 14:25:28 +00:00
struct all_of_impl;
template<>
2012-11-02 13:00:10 +00:00
struct all_of_impl<>
: public std::true_type
{};
template<>
2012-10-04 14:25:28 +00:00
struct all_of_impl<true>
: public std::true_type
{};
template<>
struct all_of_impl<false>
: public std::false_type
{};
template<bool... Tail>
struct all_of_impl<true, Tail...>
: public std::integral_constant<bool, sprout::tpp::detail::all_of_impl<Tail...>::value>
{};
template<bool... Tail>
struct all_of_impl<false, Tail...>
: public std::false_type
{};
} // namespace detail
//
2012-11-02 13:00:10 +00:00
// all_of_c
2012-10-04 14:25:28 +00:00
//
template<bool... Values>
2012-11-02 13:00:10 +00:00
struct all_of_c
2012-10-04 14:25:28 +00:00
: public sprout::tpp::detail::all_of_impl<Values...>
{};
2012-11-02 13:00:10 +00:00
//
// all_of
//
template<typename... Types>
struct all_of
: public sprout::tpp::all_of_c<Types::value...>
{};
2012-10-04 14:25:28 +00:00
} // namespace tpp
} // namespace sprout
#endif // #ifndef SPROUT_TPP_ALGORITHM_ALL_OF_HPP