Re: [Boost-bugs] [Boost C++ Libraries] #5473: [Foreach] non-const rvalue collections are treated as const collections

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5473: [Foreach] non-const rvalue collections are treated as const collections
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-04-15 01:13:52


#5473: [Foreach] non-const rvalue collections are treated as const collections
--------------------------------------+-------------------------------------
  Reporter: mimomorin@… | Owner: eric_niebler
      Type: Patches | Status: new
 Milestone: To Be Determined | Component: foreach
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------

Comment (by mimomorin@…):

 Still fail to attach a patch for `foreach.hpp`...

 The patch (will be attached) does the following:

 1. Renaming functions
 * `is_const_` --> `is_nonconst_lvalue_`
   * Its return value is also changed.
 * `is_rvalue_` --> `is_nonconst_rvalue_`
   * The name of recently added `is_rvalue_(T&&, ...)` is not changed
     because it does detect the rvalueness
     (the ellipsis parameter is no longer needed and was removed).

 2. Introducing a new macro
 * BOOST_FOREACH_IS_CONST
   * This macro returns "true" if the collection is a const lvalue/rvalue.

 3. Hacking codes for BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
   (this might be an ugly hack...)
 * simple_variant
   * To deal with non-const rvalues, non-const `get` member function is
     added. This function returns non-const pointer to the (copied)
 collection.
   * Non-const lvalue collections are detected at compile-time, and so
     the non-const `get` function is only invoked for rvalues collections.
 * `begin`/`end`, `rbegin`/`rend`
   * These functions are modified to accept non-const collections.
   * Constness of the collection is propagated by means of `auto_any_cast`.
     If the collection is const, `auto_any_cast` returns const
 `simple_variant`
     reference. Otherwise, it returns non-const `simple_variant` reference.


 All the tests (+ `mutate_rvalue.cpp`) ran successfully with the following
 compilers (both in C++03 and C++0x modes):
 gcc-4.3.5, gcc-4.4.5, gcc-4.5.2, gcc-4.6.0, clang (TOT).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5473#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC