/usr/include/boost/spirit/home/x3/auxiliary
Edit: /usr/include/boost/spirit/home/x3/auxiliary/attr.hpp (4335B)
/*=============================================================================
Copyright (c) 2001-2011 Hartmut Kaiser
Copyright (c) 2001-2014 Joel de Guzman
Copyright (c) 2013 Agustin Berge
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 BOOST_SPIRIT_X3_ATTR_JUL_23_2008_0956AM
#define BOOST_SPIRIT_X3_ATTR_JUL_23_2008_0956AM
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace spirit { namespace x3
{
namespace detail
{
template >
struct array_helper;
template
struct array_helper>
{
constexpr array_helper(Value const (&value)[N])
: value_{ value[Is]... } {}
constexpr array_helper(Value (&&value)[N])
: value_{ static_cast(value[Is])... } {}
// silence MSVC warning C4512: assignment operator could not be generated
array_helper& operator= (array_helper const&) = delete;
Value value_[N];
};
}
template
struct attr_parser : parser>
{
typedef Value attribute_type;
static bool const has_attribute =
!is_same::value;
static bool const handles_container =
traits::is_container::value;
constexpr attr_parser(Value const& value)
: value_(value) {}
constexpr attr_parser(Value&& value)
: value_(std::move(value)) {}
template
bool parse(Iterator& /* first */, Iterator const& /* last */
, Context const& /* context */, RuleContext&, Attribute& attr_) const
{
// $$$ Change to copy_to once we have it $$$
traits::move_to(value_, attr_);
return true;
}
Value value_;
// silence MSVC warning C4512: assignment operator could not be generated
attr_parser& operator= (attr_parser const&) = delete;
};
template
struct attr_parser : parser>
, detail::array_helper
{
using detail::array_helper::array_helper;
typedef Value attribute_type[N];
static bool const has_attribute =
!is_same::value;
static bool const handles_container = true;
template
bool parse(Iterator& /* first */, Iterator const& /* last */
, Context const& /* context */, RuleContext&, Attribute& attr_) const
{
// $$$ Change to copy_to once we have it $$$
traits::move_to(this->value_ + 0, this->value_ + N, attr_);
return true;
}
// silence MSVC warning C4512: assignment operator could not be generated
attr_parser& operator= (attr_parser const&) = delete;
};
template
struct get_info>
{
typedef std::string result_type;
std::string operator()(attr_parser const& /*p*/) const
{
return "attr";
}
};
struct attr_gen
{
template
constexpr attr_parser::type>::type>
operator()(Value&& value) const
{
return { std::forward(value) };
}
};
constexpr auto attr = attr_gen{};
}}}
#endif