update boost on linux
This commit is contained in:
@@ -39,10 +39,16 @@ template< typename Ch,
|
||||
class basic_buffer {
|
||||
private:
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
typedef typename Alloc::template rebind<Ch>::other allocator_type;
|
||||
#else
|
||||
typedef typename std::allocator_traits<Alloc>::template rebind_alloc<Ch> allocator_type;
|
||||
typedef std::allocator_traits<allocator_type> allocator_traits;
|
||||
#endif
|
||||
#else
|
||||
typedef std::allocator<Ch> allocator_type;
|
||||
#endif
|
||||
static Ch* allocate(std::streamsize buffer_size);
|
||||
public:
|
||||
basic_buffer();
|
||||
basic_buffer(std::streamsize buffer_size);
|
||||
@@ -144,10 +150,22 @@ void swap(buffer<Ch, Alloc>& lhs, buffer<Ch, Alloc>& rhs)
|
||||
template<typename Ch, typename Alloc>
|
||||
basic_buffer<Ch, Alloc>::basic_buffer() : buf_(0), size_(0) { }
|
||||
|
||||
template<typename Ch, typename Alloc>
|
||||
inline Ch* basic_buffer<Ch, Alloc>::allocate(std::streamsize buffer_size)
|
||||
{
|
||||
#if defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_NO_STD_ALLOCATOR)
|
||||
return static_cast<Ch*>(allocator_type().allocate(
|
||||
static_cast<BOOST_DEDUCED_TYPENAME Alloc::size_type>(buffer_size), 0));
|
||||
#else
|
||||
allocator_type alloc;
|
||||
return static_cast<Ch*>(allocator_traits::allocate(alloc,
|
||||
static_cast<BOOST_DEDUCED_TYPENAME allocator_traits::size_type>(buffer_size)));
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename Ch, typename Alloc>
|
||||
basic_buffer<Ch, Alloc>::basic_buffer(std::streamsize buffer_size)
|
||||
: buf_(static_cast<Ch*>(allocator_type().allocate(
|
||||
static_cast<BOOST_DEDUCED_TYPENAME Alloc::size_type>(buffer_size), 0))),
|
||||
: buf_(allocate(buffer_size)),
|
||||
size_(buffer_size) // Cast for SunPro 5.3.
|
||||
{ }
|
||||
|
||||
@@ -155,8 +173,14 @@ template<typename Ch, typename Alloc>
|
||||
inline basic_buffer<Ch, Alloc>::~basic_buffer()
|
||||
{
|
||||
if (buf_) {
|
||||
#if defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_NO_STD_ALLOCATOR)
|
||||
allocator_type().deallocate(buf_,
|
||||
static_cast<BOOST_DEDUCED_TYPENAME Alloc::size_type>(size_));
|
||||
#else
|
||||
allocator_type alloc;
|
||||
allocator_traits::deallocate(alloc, buf_,
|
||||
static_cast<BOOST_DEDUCED_TYPENAME allocator_traits::size_type>(size_));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +205,7 @@ void basic_buffer<Ch, Alloc>::swap(basic_buffer& rhs)
|
||||
|
||||
template<typename Ch, typename Alloc>
|
||||
buffer<Ch, Alloc>::buffer(std::streamsize buffer_size)
|
||||
: basic_buffer<Ch, Alloc>(buffer_size) { }
|
||||
: basic_buffer<Ch, Alloc>(buffer_size), ptr_(data()), eptr_(data() + buffer_size) { }
|
||||
|
||||
template<typename Ch, typename Alloc>
|
||||
inline void buffer<Ch, Alloc>::set(std::streamsize ptr, std::streamsize end)
|
||||
|
||||
Reference in New Issue
Block a user