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
16 #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
26 namespace serialization {
29 template <class T, class Allocator>
30 T* get_data(STD::vector<T,Allocator>& v)
32 return v.empty() ? 0 : &(v[0]);
35 template <class T, class Allocator>
36 T* get_data(STD::vector<T,Allocator> const & v)
38 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));
59 #endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP