Subject: [Boost-bugs] [Boost C++ Libraries] #2519: Request for an empty function to be added to boost::xpressive::basic_regex
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-11-20 03:38:06
#2519: Request for an empty function to be added to boost::xpressive::basic_regex
-------------------------------------+--------------------------------------
Reporter: mgoldshteyn_at_[hidden] | Owner: eric_niebler
Type: Feature Requests | Status: new
Milestone: Boost 1.38.0 | Component: xpressive
Version: Boost 1.37.0 | Severity: Problem
Keywords: empty xpressive regex |
-------------------------------------+--------------------------------------
Currently the only way to tell if a regex object is empty (i.e., not
containing a compiled regex) is to compare the result of its regex_id()
function to zero. This is not intuitive to a reader of such code without
explicit comments.
It would be much easier to read said code if basic_regex supplied an empty
function which internally performed this test. This would transform code
that looks like:
if (re.regex_id()!=0)
do_something(re);
to code that reads:
if (!re.empty())
do_something(re);
which is much more intuitive. It seems to me to be a trivial change that
makes xpressive regexes even more similar to the regular boost::regex in
terms of interface, so it's a win/win.
Thanks for your consideration,
Michael Goldshteyn
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2519> 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:49:59 UTC