1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

[sprout.functional] add is_transparent_function metafunction

This commit is contained in:
bolero-MURAKAMI 2013-10-26 19:09:10 +09:00
parent f1c0774f7a
commit 2a57ee6af5
42 changed files with 102 additions and 240 deletions

View file

@ -28,6 +28,8 @@ namespace sprout {
template<>
struct bit_and<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() & std::declval<U>())

View file

@ -27,6 +27,8 @@ namespace sprout {
template<>
struct bit_not<void> {
public:
typedef void is_transparent;
public:
template<typename T>
SPROUT_CONSTEXPR decltype(~std::declval<T>())

View file

@ -28,6 +28,8 @@ namespace sprout {
template<>
struct bit_or<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() | std::declval<U>())

View file

@ -28,6 +28,8 @@ namespace sprout {
template<>
struct bit_xor<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() ^ std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct divides<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() / std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct equal_to<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() == std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct greater<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() > std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct greater_equal<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() >= std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct less<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() < std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct less_equal<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() <= std::declval<U>())

View file

@ -28,6 +28,8 @@ namespace sprout {
template<>
struct logical_and<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() && std::declval<U>())

View file

@ -27,6 +27,8 @@ namespace sprout {
template<>
struct logical_not<void> {
public:
typedef void is_transparent;
public:
template<typename T>
SPROUT_CONSTEXPR decltype(!std::declval<T>())

View file

@ -28,6 +28,8 @@ namespace sprout {
template<>
struct logical_or<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() || std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct minus<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() - std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct modulus<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() % std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct multiplies<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() * std::declval<U>())

View file

@ -29,6 +29,8 @@ namespace sprout {
template<>
struct negate<void> {
public:
typedef void is_transparent;
public:
template<typename T>
SPROUT_CONSTEXPR decltype(-std::declval<T>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct not_equal_to<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() != std::declval<U>())

View file

@ -30,6 +30,8 @@ namespace sprout {
template<>
struct plus<void> {
public:
typedef void is_transparent;
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() + std::declval<U>())

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_AND_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_AND_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/bit_and.hpp>
namespace sprout {
//
// bit_and_t
// bit_and_
//
struct bit_and_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() & std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() & std::declval<U>()))
{
return sprout::forward<T>(x) & sprout::forward<U>(y);
}
};
typedef sprout::bit_and<> bit_and_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::bit_and_t bit_and_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_NOT_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_NOT_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/bit_not.hpp>
namespace sprout {
//
// bit_not_t
// bit_not_
//
struct bit_not_t {
public:
template<typename T>
SPROUT_CONSTEXPR decltype(~std::declval<T>())
operator()(T&& x)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(~std::declval<T>()))
{
return ~sprout::forward<T>(x);
}
};
typedef sprout::bit_not<> bit_not_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::bit_not_t bit_not_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_OR_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_OR_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/bit_or.hpp>
namespace sprout {
//
// bit_or_t
// bit_or_
//
struct bit_or_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() | std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() | std::declval<U>()))
{
return sprout::forward<T>(x) | sprout::forward<U>(y);
}
};
typedef sprout::bit_or<> bit_or_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::bit_or_t bit_or_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_XOR_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_BIT_XOR_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/bit_xor.hpp>
namespace sprout {
//
// bit_xor_t
// bit_xor_
//
struct bit_xor_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() ^ std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() ^ std::declval<U>()))
{
return sprout::forward<T>(x) ^ sprout::forward<U>(y);
}
};
typedef sprout::bit_xor<> bit_xor_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::bit_xor_t bit_xor_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_DEVIDES_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_DEVIDES_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/divides.hpp>
namespace sprout {
//
// divides_t
// divides_
//
struct divides_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() / std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() / std::declval<U>()))
{
return sprout::forward<T>(x) / sprout::forward<U>(y);
}
};
typedef sprout::divides<> divides_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::divides_t divides_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_EQUAL_TO_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_EQUAL_TO_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/equal_to.hpp>
namespace sprout {
//
// equal_to_t
// equal_to_
//
struct equal_to_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() == std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() == std::declval<U>()))
{
return sprout::forward<T>(x) == sprout::forward<U>(y);
}
};
typedef sprout::equal_to<> equal_to_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::equal_to_t equal_to_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/greater.hpp>
namespace sprout {
//
// greater_t
// greater_
//
struct greater_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() > std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() > std::declval<U>()))
{
return sprout::forward<T>(x) > sprout::forward<U>(y);
}
};
typedef sprout::greater<> greater_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::greater_t greater_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_EQUAL_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_GREATER_EQUAL_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/greater_equal.hpp>
namespace sprout {
//
// greater_equal_t
// greater_equal_
//
struct greater_equal_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() >= std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() >= std::declval<U>()))
{
return sprout::forward<T>(x) >= sprout::forward<U>(y);
}
};
typedef sprout::greater_equal<> greater_equal_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::greater_equal_t greater_equal_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/less.hpp>
namespace sprout {
//
// less_t
// less_
//
struct less_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() < std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() < std::declval<U>()))
{
return sprout::forward<T>(x) < sprout::forward<U>(y);
}
};
typedef sprout::less<> less_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::less_t less_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_EQUAL_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_LESS_EQUAL_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/less_equal.hpp>
namespace sprout {
//
// less_equal_t
// less_equal_
//
struct less_equal_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() <= std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() <= std::declval<U>()))
{
return sprout::forward<T>(x) <= sprout::forward<U>(y);
}
};
typedef sprout::less_equal<> less_equal_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::less_equal_t less_equal_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_AND_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_AND_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/logical_and.hpp>
namespace sprout {
//
// logical_and_t
// logical_and_
//
struct logical_and_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() && std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() && std::declval<U>()))
{
return sprout::forward<T>(x) && sprout::forward<U>(y);
}
};
typedef sprout::logical_and<> logical_and_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::logical_and_t logical_and_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_NOT_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_NOT_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/logical_not.hpp>
namespace sprout {
//
// logical_not_t
// logical_not_
//
struct logical_not_t {
public:
template<typename T>
SPROUT_CONSTEXPR decltype(!std::declval<T>())
operator()(T&& x)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(!std::declval<T>()))
{
return !sprout::forward<T>(x);
}
};
typedef sprout::logical_not<> logical_not_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::logical_not_t logical_not_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_OR_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_LOGICAL_OR_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/logical_or.hpp>
namespace sprout {
//
// logical_or_t
// logical_or_
//
struct logical_or_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() || std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() || std::declval<U>()))
{
return sprout::forward<T>(x) || sprout::forward<U>(y);
}
};
typedef sprout::logical_or<> logical_or_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::logical_or_t logical_or_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MINUS_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_MINUS_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/minus.hpp>
namespace sprout {
//
// minus_t
// minus_
//
struct minus_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() - std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() - std::declval<U>()))
{
return sprout::forward<T>(x) - sprout::forward<U>(y);
}
};
typedef sprout::minus<> minus_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::minus_t minus_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MODULUS_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_MODULUS_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/modulus.hpp>
namespace sprout {
//
// modulus_t
// modulus_
//
struct modulus_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() % std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() % std::declval<U>()))
{
return sprout::forward<T>(x) % sprout::forward<U>(y);
}
};
typedef sprout::modulus<> modulus_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::modulus_t modulus_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_MULTIPLIES_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_MULTIPLIES_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/multiplies.hpp>
namespace sprout {
//
// multiplies_t
// multiplies_
//
struct multiplies_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() * std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() * std::declval<U>()))
{
return sprout::forward<T>(x) * sprout::forward<U>(y);
}
};
typedef sprout::multiplies<> multiplies_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::multiplies_t multiplies_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_NEGATE_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_NEGATE_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/negate.hpp>
namespace sprout {
//
// negate_t
// negate_
//
struct negate_t {
public:
template<typename T>
SPROUT_CONSTEXPR decltype(-std::declval<T>())
operator()(T&& x)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(-std::declval<T>()))
{
return -sprout::forward<T>(x);
}
};
typedef sprout::negate<> negate_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::negate_t negate_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_NOT_EQUAL_TO_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_NOT_EQUAL_TO_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/not_equal_to.hpp>
namespace sprout {
//
// not_equal_to_t
// not_equal_to_
//
struct not_equal_to_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() != std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() != std::declval<U>()))
{
return sprout::forward<T>(x) != sprout::forward<U>(y);
}
};
typedef sprout::not_equal_to<> not_equal_to_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::not_equal_to_t not_equal_to_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_PLUS_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_PLUS_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/plus.hpp>
namespace sprout {
//
// plus_t
// plus_
//
struct plus_t {
public:
template<typename T, typename U>
SPROUT_CONSTEXPR decltype(std::declval<T>() + std::declval<U>())
operator()(T&& x, U&& y)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(std::declval<T>() + std::declval<U>()))
{
return sprout::forward<T>(x) + sprout::forward<U>(y);
}
};
typedef sprout::plus<> plus_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::plus_t plus_ = {};
} // anonymous-namespace

View file

@ -8,25 +8,15 @@
#ifndef SPROUT_FUNCTIONAL_POLYMORPHIC_POSITE_HPP
#define SPROUT_FUNCTIONAL_POLYMORPHIC_POSITE_HPP
#include <utility>
#include <sprout/config.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/functional/posite.hpp>
namespace sprout {
//
// posite_t
// posite_
//
struct posite_t {
public:
template<typename T>
SPROUT_CONSTEXPR decltype(+std::declval<T>())
operator()(T&& x)
const SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(+std::declval<T>()))
{
return +sprout::forward<T>(x);
}
};
typedef sprout::posite<> posite_t;
namespace {
SPROUT_STATIC_CONSTEXPR sprout::posite_t posite_ = {};
} // anonymous-namespace

View file

@ -29,6 +29,8 @@ namespace sprout {
template<>
struct posite<void> {
public:
typedef void is_transparent;
public:
template<typename T>
SPROUT_CONSTEXPR decltype(+std::declval<T>())

View file

@ -13,5 +13,6 @@
#include <sprout/functional/type_traits/inherit_if_type.hpp>
#include <sprout/functional/type_traits/is_strict_function.hpp>
#include <sprout/functional/type_traits/weak_result_type.hpp>
#include <sprout/functional/type_traits/is_transparent_function.hpp>
#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_HPP

View file

@ -0,0 +1,21 @@
/*=============================================================================
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_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP
#define SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP
#include <sprout/config.hpp>
#include <sprout/type_traits/has_xxx.hpp>
namespace sprout {
//
// is_transparent
//
SPROUT_HAS_XXX_TYPE_DEF(is_transparent_function, is_transparent);
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_TYPE_TRAITS_IS_TRANSPARENT_FUNCTION_HPP