|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81928 - trunk/boost/spirit/home/support
From: hartmut.kaiser_at_[hidden]
Date: 2012-12-13 20:45:35
Author: hkaiser
Date: 2012-12-13 20:45:34 EST (Thu, 13 Dec 2012)
New Revision: 81928
URL: http://svn.boost.org/trac/boost/changeset/81928
Log:
Spirit: Adding proper return type handling to variant visitor
Text files modified:
trunk/boost/spirit/home/support/attributes.hpp | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
Modified: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attributes.hpp (original)
+++ trunk/boost/spirit/home/support/attributes.hpp 2012-12-13 20:45:34 EST (Thu, 13 Dec 2012)
@@ -524,17 +524,16 @@
{
struct attribute_size_visitor : static_visitor<>
{
- attribute_size_visitor(std::size_t& size)
- :size_(size)
+ typedef std::size_t result_type;
+
+ attribute_size_visitor()
{}
template <typename T>
- void operator()(T const& val) const
+ std::size_t operator()(T const& val) const
{
- size_ = spirit::traits::size(val);
+ return spirit::traits::size(val);
}
-
- std::size_t& size_;
};
}
@@ -545,9 +544,7 @@
static type call(variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& val)
{
- std::size_t size = 0;
- apply_visitor(detail::attribute_size_visitor(size), val);
- return size;
+ return apply_visitor(detail::attribute_size_visitor(size), val);
}
};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk