2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2019-01-07 08:47:17 +00:00
|
|
|
Copyright (c) 2011-2019 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
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)
|
|
|
|
=============================================================================*/
|
2016-08-14 07:02:23 +00:00
|
|
|
#ifndef SPROUT_FUNCTIONAL_BIND_LITERALS_HPP
|
|
|
|
#define SPROUT_FUNCTIONAL_BIND_LITERALS_HPP
|
2013-07-07 10:10:25 +00:00
|
|
|
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/functional/bind/placeholder.hpp>
|
2016-08-14 07:02:23 +00:00
|
|
|
#include <sprout/detail/udl_namespace.hpp>
|
2013-07-07 10:10:25 +00:00
|
|
|
|
|
|
|
#if SPROUT_USE_USER_DEFINED_LITERALS
|
|
|
|
|
|
|
|
#include <sprout/type_traits/identity.hpp>
|
|
|
|
#include <sprout/detail/digits_to_int.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// placeholders_result
|
2013-07-08 16:37:01 +00:00
|
|
|
// variadic_placeholders_result
|
2013-07-07 10:10:25 +00:00
|
|
|
//
|
|
|
|
template<char... Chars>
|
|
|
|
struct placeholders_result
|
|
|
|
: public sprout::identity<
|
|
|
|
sprout::placeholder<sprout::detail::digits_to_int<int, Chars...>::value>
|
|
|
|
>
|
|
|
|
{};
|
2013-07-08 16:37:01 +00:00
|
|
|
template<char... Chars>
|
|
|
|
struct variadic_placeholders_result
|
|
|
|
: public sprout::identity<
|
|
|
|
sprout::placeholder<sprout::is_placeholder<decltype(sprout::placeholders::_va)>::value - sprout::detail::digits_to_int<int, Chars...>::value>
|
|
|
|
>
|
|
|
|
{};
|
2013-07-07 10:10:25 +00:00
|
|
|
|
2016-08-14 07:02:23 +00:00
|
|
|
namespace literals {
|
2016-04-16 00:50:04 +00:00
|
|
|
namespace placeholders {
|
2013-07-07 10:10:25 +00:00
|
|
|
//
|
|
|
|
// _
|
2013-07-08 16:37:01 +00:00
|
|
|
// _tail
|
2013-07-07 10:10:25 +00:00
|
|
|
//
|
|
|
|
template<char... Chars>
|
|
|
|
SPROUT_CONSTEXPR typename sprout::placeholders_result<Chars...>::type
|
|
|
|
operator"" _() {
|
|
|
|
typedef typename sprout::placeholders_result<Chars...>::type type;
|
|
|
|
return type();
|
|
|
|
}
|
2013-07-08 16:37:01 +00:00
|
|
|
template<char... Chars>
|
|
|
|
SPROUT_CONSTEXPR typename sprout::variadic_placeholders_result<Chars...>::type
|
|
|
|
operator"" _tail() {
|
|
|
|
typedef typename sprout::variadic_placeholders_result<Chars...>::type type;
|
|
|
|
return type();
|
|
|
|
}
|
2013-07-07 10:10:25 +00:00
|
|
|
} // namespace placeholders
|
|
|
|
|
2016-08-14 07:02:23 +00:00
|
|
|
using sprout::literals::placeholders::operator"" _;
|
|
|
|
using sprout::literals::placeholders::operator"" _tail;
|
|
|
|
} // namespace literals
|
2013-07-07 10:10:25 +00:00
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #if SPROUT_USE_USER_DEFINED_LITERALS
|
|
|
|
|
2016-08-14 07:02:23 +00:00
|
|
|
#endif // #ifndef SPROUT_FUNCTIONAL_BIND_LITERALS_HPP
|