Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55105 - trunk/boost/spirit/home/support
From: joel_at_[hidden]
Date: 2009-07-22 22:22:58


Author: djowel
Date: 2009-07-22 22:22:58 EDT (Wed, 22 Jul 2009)
New Revision: 55105
URL: http://svn.boost.org/trac/boost/changeset/55105

Log:
remove const for container's value type
Text files modified:
   trunk/boost/spirit/home/support/container.hpp | 29 +++++++++++++++++++++++++++--
   1 files changed, 27 insertions(+), 2 deletions(-)

Modified: trunk/boost/spirit/home/support/container.hpp
==============================================================================
--- trunk/boost/spirit/home/support/container.hpp (original)
+++ trunk/boost/spirit/home/support/container.hpp 2009-07-22 22:22:58 EDT (Wed, 22 Jul 2009)
@@ -64,13 +64,38 @@
 #undef BOOST_SPIRIT_IS_CONTAINER
 
     ///////////////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ template <typename T>
+ struct remove_value_const
+ {
+ typedef T type;
+ };
+
+ template <typename T>
+ struct remove_value_const<T const>
+ {
+ typedef typename remove_value_const<T>::type type;
+ };
+
+ template <typename F, typename S>
+ struct remove_value_const<std::pair<F, S> >
+ {
+ typedef typename remove_value_const<F>::type first_type;
+ typedef typename remove_value_const<S>::type second_type;
+ typedef std::pair<first_type, second_type> type;
+ };
+ }
+
     namespace result_of
     {
         ///////////////////////////////////////////////////////////////////////
         template <typename Container>
         struct value
- {
- typedef typename Container::value_type type;
+ {
+ typedef typename detail::remove_value_const<
+ typename Container::value_type>::type
+ type;
         };
 
         // this will be instantiated if the optional holds a container


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