1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

add weed parser: char_(f, l)

This commit is contained in:
bolero-MURAKAMI 2013-05-21 19:56:41 +09:00
parent e6420f2bbd
commit ab096d442c
5 changed files with 167 additions and 21 deletions

View file

@ -1,9 +1,13 @@
#ifndef SPROUT_UTILITY_VALUE_HOLDER_VALUE_HOLDER_HPP
#define SPROUT_UTILITY_VALUE_HOLDER_VALUE_HOLDER_HPP
#include <type_traits>
#include <initializer_list>
#include <sprout/config.hpp>
#include <sprout/utility/swap.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/utility/move.hpp>
#include <sprout/optional/in_place.hpp>
namespace sprout {
namespace detail {
@ -162,6 +166,20 @@ namespace sprout {
explicit SPROUT_CONSTEXPR value_holder(movable_argument_type p)
: holder_(helper_type::hold(sprout::move(p)))
{}
template<
typename... Args,
typename = typename std::enable_if<std::is_constructible<T, Args&&...>::value>::type
>
explicit SPROUT_CONSTEXPR value_holder(sprout::in_place_t, Args&&... args)
: holder_(sprout::forward<Args>(args)...)
{}
template<
typename U, typename... Args,
typename = typename std::enable_if<std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value>::type
>
explicit SPROUT_CONSTEXPR value_holder(sprout::in_place_t, std::initializer_list<U> il, Args&&... args)
: holder_(il, sprout::forward<Args>(args)...)
{}
value_holder& operator=(value_holder const&) = default;
value_holder& operator=(value_holder&&) = default;