summaryrefslogtreecommitdiff
path: root/boost/iostreams/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/iostreams/detail')
-rw-r--r--boost/iostreams/detail/buffer.hpp28
-rw-r--r--boost/iostreams/detail/config/fpos.hpp2
2 files changed, 27 insertions, 3 deletions
diff --git a/boost/iostreams/detail/buffer.hpp b/boost/iostreams/detail/buffer.hpp
index 72400f04ca..35cb33c700 100644
--- a/boost/iostreams/detail/buffer.hpp
+++ b/boost/iostreams/detail/buffer.hpp
@@ -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);
@@ -145,9 +151,21 @@ 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
}
}
diff --git a/boost/iostreams/detail/config/fpos.hpp b/boost/iostreams/detail/config/fpos.hpp
index de8bdb84aa..12c13a0f1e 100644
--- a/boost/iostreams/detail/config/fpos.hpp
+++ b/boost/iostreams/detail/config/fpos.hpp
@@ -25,7 +25,7 @@
#include <boost/config.hpp>
# if (defined(_YVALS) || defined(_CPPLIB_VER)) && !defined(__SGI_STL_PORT) && \
- !defined(_STLPORT_VERSION) && !defined(__QNX__) && !defined(_VX_CPU)
+ !defined(_STLPORT_VERSION) && !defined(__QNX__) && !defined(_VX_CPU) && !defined(__VXWORKS__)
/**/
#include <boost/iostreams/detail/ios.hpp>