Boost logo

Boost :

Subject: Re: [boost] [container][memory] Request to move allocator_arg_t and uses_allocator to a memory related file.
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-03-31 06:04:31

El 31/03/2012 11:03, Vicente J. Botet Escriba escribió:
> I see that Boost.Container has already defined in namespace
> boost::container and in file boost/container/scoped_allocator.hpp the
> following
> struct allocator_arg_t { };
> constexpr allocator_arg_t allocator_arg = allocator_arg_t();
> template <class T, class Alloc> struct uses_allocator;

There is no constexpr in Boost.Container code. Current trunk code
includes an experimental implementation of scoped_allocator, for C++03
and C++11 compilers.

> I would like to shared these to all the Boost libraries. I don't think
> it is a good idea to make Boost.Thread depend on Boost.Container just
> for this. Could these declarations be included in a specific file? These
> declaration are included in <memory> in the C++11. What would be the
> best library to contain these declarations?

I don't think Boost.thread should depend on Boost.Container, that's why
I've added those classes to boost::container namespace, avoiding any
boost:: namespace pollution. The idea is also to define them as std::
typedefs so that a user with a C++11 conforming standard library does
not need to add boost::container::xxx overloads. And user C++03 code
using boost::xxx types is standard conforming when compiled with C++11

> What about a new boost/memory.hpp file?
> What about moving them to the boost or boost::memory namespace?

I think it's a good idea. But we should just typedef them to std:: if
the standard library provides those types. I think GCC 4.7 libstdc++ and
libc++ already support scoped allocators.



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