1
0
Fork 0
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:
bolero-MURAKAMI 2013-11-20 22:04:11 +09:00
parent d386893a74
commit bf0c7021cf
350 changed files with 2628 additions and 1912 deletions

View file

@ -13,14 +13,14 @@
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include <sprout/algorithm/fixed/results.hpp>
namespace sprout {
namespace detail {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_2(Result const& result, Args const&... args) {
return sprout::remake<Result>(result, sprout::size(result), args...);
@ -28,7 +28,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_2(Result const& result, Args const&... args) {
return container_complate_2(result, args..., *sprout::next(sprout::internal_begin(result), sizeof...(Args)));
@ -36,7 +36,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_1(
Result const& result,
@ -49,7 +49,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_1(
Result const& result,
@ -65,7 +65,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate(Result const& result, Args const&... args) {
return sprout::remake<Result>(result, sprout::size(result), args...);
@ -73,7 +73,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate(Result const& result, Args const&... args) {
return container_complate_1(result, sprout::internal_begin_offset(result), args...);

View file

@ -13,14 +13,14 @@
#include <sprout/container/traits.hpp>
#include <sprout/container/functions.hpp>
#include <sprout/iterator/operation.hpp>
#include <sprout/algorithm/fixed/result_of.hpp>
#include <sprout/algorithm/fixed/results.hpp>
namespace sprout {
namespace detail {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_backward_2(Result const& result, Args const&... args) {
return sprout::remake<Result>(result, sprout::size(result), args...);
@ -28,7 +28,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_backward_2(Result const& result, Args const&... args) {
return container_complate_backward_2(result, *sprout::prev(sprout::internal_end(result), sizeof...(Args) + 1), args...);
@ -36,7 +36,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_backward_1(
Result const& result,
@ -49,7 +49,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_backward_1(
Result const& result,
@ -65,7 +65,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size == sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_backward(Result const& result, Args const&... args) {
return sprout::remake<Result>(result, sprout::size(result), args...);
@ -73,7 +73,7 @@ namespace sprout {
template<typename Result, typename... Args>
inline SPROUT_CONSTEXPR typename std::enable_if<
sprout::container_traits<Result>::static_size != sizeof...(Args),
typename sprout::fixed::result_of::algorithm<Result>::type
typename sprout::fixed::results::algorithm<Result>::type
>::type
container_complate_backward(Result const& result, Args const&... args) {
return container_complate_backward_1(result, sprout::internal_end_offset_backward(result), args...);

123
sprout/detail/predef.hpp Normal file
View file

@ -0,0 +1,123 @@
/*=============================================================================
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_DETAIL_PREDEF_HPP
#define SPROUT_DETAIL_PREDEF_HPP
#include <sprout/config.hpp>
//
// SPROUT_IS_GCC
//
#if defined(__GNUC__)
# define SPROUT_IS_GCC (1)
#else
# define SPROUT_IS_GCC (0)
#endif
//
// SPROUT_GCC_LESS
// SPROUT_GCC_GREATER
// SPROUT_GCC_LESS_EQUAL
// SPROUT_GCC_GREATER_EQUAL
//
#if SPROUT_IS_GCC
# define SPROUT_GCC_LESS(major, minor, patch) ( \
__GNUC__ < major \
|| (__GNUC__ == major && __GNUC_MINOR__ < minor) \
|| (__GNUC__ == major && __GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ < patch) \
)
# define SPROUT_GCC_GREATER(major, minor, patch) ( \
__GNUC__ > major \
|| (__GNUC__ == major && __GNUC_MINOR__ > minor) \
|| (__GNUC__ == major && __GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ > patch) \
)
# define SPROUT_GCC_LESS_EQUAL(major, minor, patch) ( \
__GNUC__ < major \
|| (__GNUC__ == major && __GNUC_MINOR__ < minor) \
|| (__GNUC__ == major && __GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ <= patch) \
)
# define SPROUT_GCC_GREATER_EQUAL(major, minor, patch) ( \
__GNUC__ > major \
|| (__GNUC__ == major && __GNUC_MINOR__ > minor) \
|| (__GNUC__ == major && __GNUC_MINOR__ == minor && __GNUC_PATCHLEVEL__ >= patch) \
)
#else
# define SPROUT_GCC_LESS(major, minor, patch) (0)
# define SPROUT_GCC_GREATER(major, minor, patch) (0)
# define SPROUT_GCC_LESS_EQUAL(major, minor, patch) (0)
# define SPROUT_GCC_GREATER_EQUAL(major, minor, patch) (0)
#endif
//
// SPROUT_GCC_BETWEEN
//
#if SPROUT_IS_GCC
# define SPROUT_GCC_BETWEEN(major1, minor1, patch1, major2, minor2, patch2) \
SPROUT_GCC_GREATER_EQUAL(major1, minor1, patch1) && SPROUT_GCC_LESS(major2, minor2, patch2)
#else
# define SPROUT_GCC_BETWEEN(major1, minor1, patch1, major2, minor2, patch2) (0)
#endif
//
// SPROUT_IS_CLANG
//
#if defined(__clang__)
# define SPROUT_IS_CLANG (1)
#else
# define SPROUT_IS_CLANG (0)
#endif
//
// SPROUT_CLANG_HAS_FUTURE
//
#if SPROUT_IS_CLANG
# define SPROUT_CLANG_HAS_FUTURE(future) (__has_feature(future))
#else
# define SPROUT_CLANG_HAS_FUTURE(future) (0)
#endif
//
// SPROUT_CLANG_LESS
// SPROUT_CLANG_GREATER
// SPROUT_CLANG_LESS_EQUAL
// SPROUT_CLANG_GREATER_EQUAL
//
#if SPROUT_IS_CLANG
# define SPROUT_CLANG_LESS(major, minor, patch) ( \
__clang_major__ < major \
|| (__clang_major__ == major && __clang_minor__ < minor) \
|| (__clang_major__ == major && __clang_minor__ == minor && __clang_patchlevel__ < patch) \
)
# define SPROUT_CLANG_GREATER(major, minor, patch) ( \
__clang_major__ > major \
|| (__clang_major__ == major && __clang_minor__ > minor) \
|| (__clang_major__ == major && __clang_minor__ == minor && __clang_patchlevel__ > patch) \
)
# define SPROUT_CLANG_LESS_EQUAL(major, minor, patch) ( \
__clang_major__ < major \
|| (__clang_major__ == major && __clang_minor__ < minor) \
|| (__clang_major__ == major && __clang_minor__ == minor && __clang_patchlevel__ <= patch) \
)
# define SPROUT_CLANG_GREATER_EQUAL(major, minor, patch) ( \
__clang_major__ > major \
|| (__clang_major__ == major && __clang_minor__ > minor) \
|| (__clang_major__ == major && __clang_minor__ == minor && __clang_patchlevel__ >= patch) \
)
#else
# define SPROUT_CLANG_LESS(major, minor, patch) (0)
# define SPROUT_CLANG_GREATER(major, minor, patch) (0)
# define SPROUT_CLANG_LESS_EQUAL(major, minor, patch) (0)
# define SPROUT_CLANG_GREATER_EQUAL(major, minor, patch) (0)
#endif
//
// SPROUT_CLANG_BETWEEN
//
#if SPROUT_IS_CLANG
# define SPROUT_CLANG_BETWEEN(major1, minor1, patch1, major2, minor2, patch2) \
SPROUT_CLANG_GREATER_EQUAL(major1, minor1, patch1) && SPROUT_CLANG_LESS(major2, minor2, patch2)
#else
# define SPROUT_CLANG_BETWEEN(major1, minor1, patch1, major2, minor2, patch2) (0)
#endif
#endif // #ifndef SPROUT_DETAIL_PREDEF_HPP