Subject: [Boost-bugs] [Boost C++ Libraries] #4020: regex::match_results::format functor cannot use member variables
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-16 18:33:21
#4020: regex::match_results::format functor cannot use member variables
-------------------------------------------------+--------------------------
Reporter: Keith MacDonald <keith@â¦> | Owner: johnmaddock
Type: Support Requests | Status: new
Milestone: Boost 1.43.0 | Component: regex
Version: Boost 1.42.0 | Severity: Problem
Keywords: regex functor |
-------------------------------------------------+--------------------------
regex::match_results::format makes a copy of its functor argument. This
is restrictive, because it prevents the functor from managing its state
using member variables. Is that intentional?
The attached VC++ 2008 code demonstrates the problem. When it uses a
member variable to maintain a count, its output is:
(1)The (1)quick (1)brown (1)fox (1)jumped (1)over (1)the (1)lazy (1)dog
Making the counter global instead gives the correct output:
(1)The (2)quick (3)brown (4)fox (5)jumped (6)over (7)the (8)lazy (9)dog
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4020> 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:02 UTC