Boost logo

Boost :

Subject: Re: [boost] Cxx dual library
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2016-06-06 17:10:38

Le 05/06/2016 à 09:47, Niall Douglas a écrit :
> 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.
>> In the end, the user always includes the foo header and uses the foo
>> name. There are no macros in the user's code. Both solutions select one
>> implementation or the other. Yours refers to the namespace of the
>> selected implementation with a macro, while his just uses namespace foo.
> Do you mean an ultra-simplified form of what boost-lite does like
> this:
> namespace boost { namespace afio {
> namespace stl11 = ::boost;
> #else
> namespace stl11 = ::std;
> #endif
> namespace stl1z = ::boost;
> #else
> namespace stl1z = ::std;
> #endif
> } }
> This works, but it's quite ungranular e.g. how do you mash up
> Boost.Thread with Std.Atomic? You could enable this at the cost of
> extra typing imposed on the end user like this:
> namespace boost { namespace afio { namespace stl {
> namespace atomic = ::boost;
> #else
> namespace atomic = ::std;
> #endif
> namespace thread = ::boost;
> #else
> namespace thread = ::std;
> #endif
> 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.
> 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.
> Still, the above works.

No boost::thread::csbl doesn't follows the previous schema.
CSBL provides a single interface depending of the conditions.


#include <boost/config.hpp>
// MSVC has some trouble instantiating a non_copyable type
//C:\Program Files (x86)\Microsoft Visual Studio
11.0\VC\INCLUDE\xmemory0(606) : error C2248:
'non_copyable::non_copyable' : cannot access private member declared in
class 'non_copyable'
: see declaration of 'non_copyable::non_copyable'
: see declaration of 'non_copyable'
// C:\Program Files (x86)\Microsoft Visual Studio
11.0\VC\INCLUDE\xmemory0(605) : while compiling class template member
function 'void std::allocator<_Ty>::construct(_Ty *,const _Ty &)'
// with
// [
// _Ty=non_copyable
// ]
#if defined BOOST_THREAD_USES_BOOST_QUEUE || defined
#include <boost/container/queue.hpp>
#include <queue>

namespace boost
   namespace csbl
     using ::boost::container::queue;

     using ::std::queue;


#endif // header

On the user side

#include <boost/thread/csbl/queue.hpp>

Make use of boost::csbl::queue as you will use std::queue or

That's all.

I'm not trying to shell CSBL as I believe it has the same issues as CXXD
or BoostLite, when several parts of an application make use of boost or
the standard library. Either all parts use CSBL or it doesn't work well,
as we have yet to manage with the interaction of the different

An alternative to this design is for the Boost libraries that don't add
anything specific to the standard one to just do this. But Boost
libraries very often have some extension or some differences because
their implementation was done before the standard was closed.

I believe that the minor syntactical differences between boost and std
are annoying and make it difficult to write code that can use boost or
std interchangeably. This is why I was proposing in another thread to
have a fork of the C++11 library ported to C++98. Maybe I'm wrong yet
with the approach.

I wanted just to show it as an alternative design to the macro design
proposed by Edward.


Boost list run by bdawes at, gregod at, cpdaniel at, john at