Boost logo

Boost :

Subject: Re: [boost] Cxx dual library
From: Rob Stewart (rstewart_at_[hidden])
Date: 2016-06-05 17:53:44


On June 5, 2016 3:47:42 AM EDT, Niall Douglas <s_sourceforge_at_[hidden]> wrote:
>On 4 Jun 2016 at 21:28, Rob Stewart wrote:
>
>> Edward, you've missed that Vicente doesn't see that importing either
>> a Boost or a Standard Library solution, into a common namespace
>requires
>> anything more of the user.
>>
>> The user would always use the new, common namespace name for
>something,
>> regardless of its original namespace. For example, foo::x is the
>common
>> name, but x may have been introduced into the foo namespace, by a
>> using directive, from the boost or the std namespace.
>
>Do you mean an ultra-simplified

It was Vicente's idea.

>form of what boost-lite does like this:
>
>namespace boost { namespace afio {
>#if BOOST_AFIO_USING_BOOST_THREAD
> namespace stl11 = ::boost;
>#else
> namespace stl11 = ::std;
>#endif
>
>#if BOOST_AFIO_USING_BOOST_FILESYSTEM
> namespace stl1z = ::boost;
>#else
> namespace stl1z = ::std;
>#endif
>} }

No, that wasn't what he was suggesting.

>namespace boost { namespace afio { namespace stl {
>#if BOOST_AFIO_USING_BOOST_ATOMIC
> namespace atomic = ::boost;
>#else
> namespace atomic = ::std;
>#endif
>
>#if BOOST_AFIO_USING_BOOST_THREAD
> namespace thread = ::boost;
>#else
> namespace thread = ::std;
>#endif
>
>#if BOOST_AFIO_USING_BOOST_FILESYSTEM
> namespace filesystem = ::boost;
>#else
> namespace filesystem = ::std;
>#endif
>} } }
>
>Now end user code must always write stl::<selector>::<class>. This I
>think would work well enough.

That also wasn't what he suggested.

>I'll reiterate that boost-lite requires less typing on the end user
>and is much safer and less error prone to use than the above scheme.

Vicente's idea was to import, say, std::thread or boost::thread into a new, common namespace. That is, foo::thread might refer to either of the others, based upon platform support or even an override macro.

___
Rob

(Sent from my portable computation engine)


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