Boost logo

Boost :

Subject: Re: [boost] Review Request: Introduction of boost::string namespace and string-conversion functions
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-02-14 00:12:16


On Fri, Feb 13, 2009 at 23:48, Vladimir Batov <batov_at_[hidden]> wrote:
>
> I am not saying "boost::strings isn't good enough". It just looks odd to me.
> I've never seen boost:lamdas, etc.
>

The library's primary namespace (in parent ::boost) is given that same
name, except when there's a component with that name (e.g.,
boost::tuple), in which case the namespace name is pluralized. For
example, ::boost::filesystem.

http://www.boost.org/development/requirements.html#Naming_consistency

And perhaps you recall a small discussion about boost::uuids::uuid? :P

I have a full response to the thread coming, but to tide you over
while I'm typing, here's something overly cute that works in g++ 4.1.2
and I think is conforming:

    int i = 0;
    std::stringstream("1") >> i;
    std::cout << i << std::endl;
    std::stringstream("11") >> std::hex >> i;
    std::cout << i << std::endl;
    (std::stringstream("a") >> std::hex >> i) || (i = 2);
    std::cout << i << std::endl;
    (std::stringstream("a") >> i) || (i = 3);
    std::cout << i << std::endl;

It gives, as expected:

1
17
10
3

Yes, I know it has lots of problems -- "1z" comes to mind -- but I enjoyed it.

~ Scott


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk