diff options
Diffstat (limited to 'boost/spirit/home/x3/core/detail/parse_into_container.hpp')
-rw-r--r-- | boost/spirit/home/x3/core/detail/parse_into_container.hpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/boost/spirit/home/x3/core/detail/parse_into_container.hpp b/boost/spirit/home/x3/core/detail/parse_into_container.hpp index 45ecc41ae0..4f2310a8e5 100644 --- a/boost/spirit/home/x3/core/detail/parse_into_container.hpp +++ b/boost/spirit/home/x3/core/detail/parse_into_container.hpp @@ -4,8 +4,8 @@ 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) =============================================================================*/ -#if !defined(SPIRIT_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM) -#define SPIRIT_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM +#if !defined(BOOST_SPIRIT_X3_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM) +#define BOOST_SPIRIT_X3_PARSE_INTO_CONTAINER_JAN_15_2013_0957PM #include <type_traits> @@ -17,6 +17,7 @@ #include <boost/spirit/home/x3/support/traits/is_substitute.hpp> #include <boost/spirit/home/x3/support/traits/move_to.hpp> #include <boost/mpl/and.hpp> +#include <boost/fusion/include/at_key.hpp> #include <boost/fusion/include/front.hpp> #include <boost/fusion/include/back.hpp> #include <boost/variant/apply_visitor.hpp> @@ -37,10 +38,6 @@ namespace boost { namespace spirit { namespace x3 { namespace detail } }; -/* $$$ clang reports: warning: class template partial specialization contains - * a template parameter that can not be deduced; this partial specialization - * will never be used $$$ - * // save to associative fusion container where Key // is variant over possible keys template <typename ...T> @@ -54,7 +51,7 @@ namespace boost { namespace spirit { namespace x3 { namespace detail apply_visitor(saver_visitor<Attribute, Value>(attr, value), key); } }; -*/ + template <typename Attribute, typename Value> struct saver_visitor : boost::static_visitor<void> { @@ -245,18 +242,27 @@ namespace boost { namespace spirit { namespace x3 { namespace detail parser, first, last, context, rcontext, attr); } + template <typename Iterator> + static bool call( + Parser const& parser + , Iterator& first, Iterator const& last + , Context const& context, RContext& rcontext, unused_type attr, mpl::true_) + { + return parser.parse(first, last, context, rcontext, attr); + } + template <typename Iterator, typename Attribute> static bool call( Parser const& parser , Iterator& first, Iterator const& last , Context const& context, RContext& rcontext, Attribute& attr, mpl::true_) { - if (attr.empty()) + if (traits::is_empty(attr)) return parser.parse(first, last, context, rcontext, attr); Attribute rest; bool r = parser.parse(first, last, context, rcontext, rest); if (r) - attr.insert(attr.end(), rest.begin(), rest.end()); + traits::append(attr, rest.begin(), rest.end()); return r; } |