add is_found_via_adl metafunction

This commit is contained in:
bolero-MURAKAMI 2012-09-29 23:39:00 +09:00
parent 2dcafaa98d
commit da86582643
9 changed files with 30 additions and 13 deletions

View file

@ -1,13 +1,30 @@
#ifndef SPROUT_ADL_NOT_FOUND_HPP
#define SPROUT_ADL_NOT_FOUND_HPP
#include <type_traits>
#include <sprout/config.hpp>
namespace sprout {
//
// adl_not_found
// not_found_via_adl
//
struct adl_not_found {};
struct not_found_via_adl {};
//
// is_not_found_via_adl
//
template<typename T>
struct is_not_found_via_adl
: public std::is_same<T, sprout::not_found_via_adl>
{};
//
// is_found_via_adl
//
template<typename T>
struct is_found_via_adl
: public std::integral_constant<bool, sprout::is_not_found_via_adl<T>::value>
{};
} // namespace sprout
#endif // #ifndef SPROUT_ADL_NOT_FOUND_HPP

View file

@ -7,7 +7,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found range_begin(...);
sprout::not_found_via_adl range_begin(...);
} // namespace sprout_adl
namespace sprout {

View file

@ -7,7 +7,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found range_end(...);
sprout::not_found_via_adl range_end(...);
} // namespace sprout_adl
namespace sprout {

View file

@ -9,7 +9,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found generated_value(...);
sprout::not_found_via_adl generated_value(...);
} // namespace sprout_adl
namespace sprout_generator_detail {
@ -37,7 +37,7 @@ namespace sprout_generator_detail {
template<
typename U = T,
typename sprout::enabler_if<
!std::is_same<decltype(generated_value(std::declval<U>())), sprout::adl_not_found>::value
sprout::is_found_via_adl<decltype(generated_value(std::declval<U>()))>::value
>::type = sprout::enabler
>
static std::true_type test(int);

View file

@ -9,7 +9,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found next_generator(...);
sprout::not_found_via_adl next_generator(...);
} // namespace sprout_adl
namespace sprout_generator_detail {
@ -37,7 +37,7 @@ namespace sprout_generator_detail {
template<
typename U = T,
typename sprout::enabler_if<
!std::is_same<decltype(next_generator(std::declval<U>())), sprout::adl_not_found>::value
sprout::is_found_via_adl<decltype(next_generator(std::declval<U>()))>::value
>::type = sprout::enabler
>
static std::true_type test(int);

View file

@ -7,7 +7,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found iterator_distance(...);
sprout::not_found_via_adl iterator_distance(...);
} // namespace sprout_adl
namespace sprout {

View file

@ -7,7 +7,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found iterator_next(...);
sprout::not_found_via_adl iterator_next(...);
} // namespace sprout_adl
namespace sprout {

View file

@ -7,7 +7,7 @@
#include <sprout/adl/not_found.hpp>
namespace sprout_adl {
sprout::adl_not_found iterator_prev(...);
sprout::not_found_via_adl iterator_prev(...);
} // namespace sprout_adl
namespace sprout {

View file

@ -93,7 +93,7 @@ namespace sprout {
namespace sprout_adl {
template<std::size_t I>
sprout::adl_not_found tuple_get(...);
sprout::not_found_via_adl tuple_get(...);
} // namespace sprout_adl
namespace sprout_tuple_detail {
@ -105,7 +105,7 @@ namespace sprout_tuple_detail {
template<
typename U = T,
typename sprout::enabler_if<
!std::is_same<decltype(tuple_get<I>(std::declval<U>())), sprout::adl_not_found>::value
sprout::is_found_via_adl<decltype(tuple_get<I>(std::declval<U>()))>::value
>::type = sprout::enabler
>
static std::true_type test(int);