1 // (C) Copyright 2005 Matthias Troyer
2 // Use, modification and distribution is subject to the Boost Software
3 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org for updates, documentation, and revision history.
8 #ifndef BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
9 #define BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
11 // MS compatible compilers support #pragma once
12 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
16 #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
26 namespace boost
{ namespace serialization
{ namespace detail
{
28 template <class T
, class Allocator
>
29 T
* get_data(STD::vector
<T
,Allocator
>& v
)
31 return v
.empty() ? 0 : &(v
[0]);
34 template <class T
, class Allocator
>
35 T
* get_data(STD::vector
<T
,Allocator
> const & v
)
37 return get_data(const_cast<STD::vector
<T
,Allocator
>&>(v
));
42 T
* get_data(STD::valarray
<T
>& v
)
44 return v
.size()==0 ? 0 : &(v
[0]);
48 const T
* get_data(STD::valarray
<T
> const& v
)
50 return get_data(const_cast<STD::valarray
<T
>&>(v
));
53 } } } //namespace boost::serialization::detail
55 #endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP