Sprout/sprout/tpp/algorithm/none_of.hpp

58 lines
1.5 KiB
C++
Raw Normal View History

2013-08-08 09:54:33 +00:00
/*=============================================================================
Copyright (c) 2011-2013 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
2012-10-04 14:25:28 +00:00
#ifndef SPROUT_TPP_ALGORITHM_NONE_OF_HPP
#define SPROUT_TPP_ALGORITHM_NONE_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 none_of_impl;
template<>
2012-11-02 13:00:10 +00:00
struct none_of_impl<>
: public std::true_type
{};
template<>
2012-10-04 14:25:28 +00:00
struct none_of_impl<true>
: public std::false_type
{};
template<>
struct none_of_impl<false>
: public std::true_type
{};
template<bool... Tail>
struct none_of_impl<true, Tail...>
: public std::false_type
{};
template<bool... Tail>
struct none_of_impl<false, Tail...>
: public std::integral_constant<bool, sprout::tpp::detail::none_of_impl<Tail...>::value>
{};
} // namespace detail
//
2012-11-02 13:00:10 +00:00
// none_of_c
2012-10-04 14:25:28 +00:00
//
template<bool... Values>
2012-11-02 13:00:10 +00:00
struct none_of_c
2012-10-04 14:25:28 +00:00
: public sprout::tpp::detail::none_of_impl<Values...>
{};
2012-11-02 13:00:10 +00:00
//
// none_of
//
template<typename... Types>
struct none_of
: public sprout::tpp::none_of_c<Types::value...>
{};
2012-10-04 14:25:28 +00:00
} // namespace tpp
} // namespace sprout
#endif // #ifndef SPROUT_TPP_ALGORITHM_NONE_OF_HPP