mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
modify namespace result_of -> results
support C++14 type_traits
This commit is contained in:
parent
d386893a74
commit
bf0c7021cf
350 changed files with 2628 additions and 1912 deletions
|
@ -13,5 +13,7 @@
|
|||
#include <sprout/tpp/algorithm/any_of.hpp>
|
||||
#include <sprout/tpp/algorithm/none_of.hpp>
|
||||
#include <sprout/tpp/algorithm/one_of.hpp>
|
||||
#include <sprout/tpp/algorithm/min_element.hpp>
|
||||
#include <sprout/tpp/algorithm/max_element.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_TPP_ALGORITHM_HPP
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tpp {
|
||||
|
@ -18,23 +19,23 @@ namespace sprout {
|
|||
struct all_of_impl;
|
||||
template<>
|
||||
struct all_of_impl<>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<>
|
||||
struct all_of_impl<true>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<>
|
||||
struct all_of_impl<false>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct all_of_impl<true, Tail...>
|
||||
: public std::integral_constant<bool, sprout::tpp::detail::all_of_impl<Tail...>::value>
|
||||
: public sprout::integral_constant<bool, sprout::tpp::detail::all_of_impl<Tail...>::value>
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct all_of_impl<false, Tail...>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#ifndef SPROUT_TPP_ALGORITHM_ANY_OF_HPP
|
||||
#define SPROUT_TPP_ALGORITHM_ANY_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tpp {
|
||||
|
@ -18,23 +18,23 @@ namespace sprout {
|
|||
struct any_of_impl;
|
||||
template<>
|
||||
struct any_of_impl<>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<>
|
||||
struct any_of_impl<true>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<>
|
||||
struct any_of_impl<false>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct any_of_impl<true, Tail...>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct any_of_impl<false, Tail...>
|
||||
: public std::integral_constant<bool, sprout::tpp::detail::any_of_impl<Tail...>::value>
|
||||
: public sprout::integral_constant<bool, sprout::tpp::detail::any_of_impl<Tail...>::value>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
|
|
50
sprout/tpp/algorithm/max_element.hpp
Normal file
50
sprout/tpp/algorithm/max_element.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*=============================================================================
|
||||
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)
|
||||
=============================================================================*/
|
||||
#ifndef SPROUT_TPP_ALGORITHM_MAX_ELEMENT_HPP
|
||||
#define SPROUT_TPP_ALGORITHM_MAX_ELEMENT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
#include <sprout/type_traits/common_decay.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tpp {
|
||||
namespace detail {
|
||||
template<typename T, T... Values>
|
||||
struct max_element_impl;
|
||||
template<typename T, T Value>
|
||||
struct max_element_impl<T, Value>
|
||||
: public sprout::integral_constant<T, Value>
|
||||
{};
|
||||
template<typename T, T Value1, T Value2>
|
||||
struct max_element_impl<T, Value1, Value2>
|
||||
: public sprout::integral_constant<T, (Value1 < Value2 ? Value2 : Value1)>
|
||||
{};
|
||||
template<typename T, T Value1, T Value2, T... Tail>
|
||||
struct max_element_impl<T, Value1, Value2, Tail...>
|
||||
: public sprout::tpp::detail::max_element_impl<T, sprout::tpp::detail::max_element_impl<T, Value1, Value2>::value, Tail...>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
// max_element_c
|
||||
//
|
||||
template<typename T, T... Values>
|
||||
struct max_element_c
|
||||
: public sprout::tpp::detail::max_element_impl<T, Values...>
|
||||
{};
|
||||
//
|
||||
// max_element
|
||||
//
|
||||
template<typename... Types>
|
||||
struct max_element
|
||||
: public sprout::tpp::max_element_c<typename sprout::common_decay<decltype(Types::value)...>::type, Types::value...>
|
||||
{};
|
||||
} // namespace tpp
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TPP_ALGORITHM_MAX_ELEMENT_HPP
|
50
sprout/tpp/algorithm/min_element.hpp
Normal file
50
sprout/tpp/algorithm/min_element.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*=============================================================================
|
||||
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)
|
||||
=============================================================================*/
|
||||
#ifndef SPROUT_TPP_ALGORITHM_MIN_ELEMENT_HPP
|
||||
#define SPROUT_TPP_ALGORITHM_MIN_ELEMENT_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/common_decay.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tpp {
|
||||
namespace detail {
|
||||
template<typename T, T... Values>
|
||||
struct min_element_impl;
|
||||
template<typename T, T Value>
|
||||
struct min_element_impl<T, Value>
|
||||
: public sprout::integral_constant<T, Value>
|
||||
{};
|
||||
template<typename T, T Value1, T Value2>
|
||||
struct min_element_impl<T, Value1, Value2>
|
||||
: public sprout::integral_constant<T, (Value2 < Value1 ? Value2 : Value1)>
|
||||
{};
|
||||
template<typename T, T Value1, T Value2, T... Tail>
|
||||
struct min_element_impl<T, Value1, Value2, Tail...>
|
||||
: public sprout::tpp::detail::min_element_impl<T, sprout::tpp::detail::min_element_impl<T, Value1, Value2>::value, Tail...>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
// min_element_c
|
||||
//
|
||||
template<typename T, T... Values>
|
||||
struct min_element_c
|
||||
: public sprout::tpp::detail::min_element_impl<T, Values...>
|
||||
{};
|
||||
//
|
||||
// min_element
|
||||
//
|
||||
template<typename... Types>
|
||||
struct min_element
|
||||
: public sprout::tpp::min_element_c<typename sprout::common_decay<decltype(Types::value)...>::type, Types::value...>
|
||||
{};
|
||||
} // namespace tpp
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_TPP_ALGORITHM_MIN_ELEMENT_HPP
|
|
@ -8,8 +8,8 @@
|
|||
#ifndef SPROUT_TPP_ALGORITHM_NONE_OF_HPP
|
||||
#define SPROUT_TPP_ALGORITHM_NONE_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tpp {
|
||||
|
@ -18,23 +18,23 @@ namespace sprout {
|
|||
struct none_of_impl;
|
||||
template<>
|
||||
struct none_of_impl<>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<>
|
||||
struct none_of_impl<true>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<>
|
||||
struct none_of_impl<false>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct none_of_impl<true, Tail...>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct none_of_impl<false, Tail...>
|
||||
: public std::integral_constant<bool, sprout::tpp::detail::none_of_impl<Tail...>::value>
|
||||
: public sprout::integral_constant<bool, sprout::tpp::detail::none_of_impl<Tail...>::value>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#ifndef SPROUT_TPP_ALGORITHM_ONE_OF_HPP
|
||||
#define SPROUT_TPP_ALGORITHM_ONE_OF_HPP
|
||||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/tpp/algorithm/none_of.hpp>
|
||||
#include <sprout/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace tpp {
|
||||
|
@ -19,15 +19,15 @@ namespace sprout {
|
|||
struct one_of_impl;
|
||||
template<>
|
||||
struct one_of_impl<>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<>
|
||||
struct one_of_impl<true>
|
||||
: public std::true_type
|
||||
: public sprout::true_type
|
||||
{};
|
||||
template<>
|
||||
struct one_of_impl<false>
|
||||
: public std::false_type
|
||||
: public sprout::false_type
|
||||
{};
|
||||
template<bool... Tail>
|
||||
struct one_of_impl<true, Tail...>
|
||||
|
@ -35,7 +35,7 @@ namespace sprout {
|
|||
{};
|
||||
template<bool... Tail>
|
||||
struct one_of_impl<false, Tail...>
|
||||
: public std::integral_constant<bool, sprout::tpp::detail::one_of_impl<Tail...>::value>
|
||||
: public sprout::integral_constant<bool, sprout::tpp::detail::one_of_impl<Tail...>::value>
|
||||
{};
|
||||
} // namespace detail
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue