19 template<
typename T >
20 void DataOStreamArchive::save_array(
const boost::serialization::array< T >& a,
23 _stream << Array< const T >( a.address(), a.count( ));
26 template<
class C,
class T,
class A >
27 void DataOStreamArchive::save(
const std::basic_string< C, T, A >& s )
30 BOOST_STATIC_ASSERT(
sizeof(C) ==
sizeof(
char));
34 template<
typename T >
35 typename boost::enable_if< boost::is_integral<T> >::type
36 DataOStreamArchive::save(
const T& t )
38 #if BOOST_VERSION < 104800
39 namespace bs = boost::detail;
41 namespace bs = boost::spirit::detail;
51 #pragma clang diagnostic push
52 #pragma clang diagnostic ignored "-Wshift-count-overflow"
54 #pragma clang diagnostic pop
57 while( temp != 0 && temp != (T) -1 );
60 _saveSignedChar( t > 0 ? size : -size );
61 BOOST_ASSERT( t > 0 || boost::is_signed<T>::value) ;
65 bs::store_little_endian<T, sizeof(T)>( &temp, t );
66 save_binary( &temp, size );
73 template<
typename T >
74 typename boost::enable_if< boost::is_floating_point<T> >::type
75 DataOStreamArchive::save(
const T& t )
77 namespace fp = boost::spirit::math;
79 typedef typename fp::detail::fp_traits<T>::type traits;
82 if( get_flags() & serialization::no_infnan && !fp::isfinite( t ))
83 throw DataStreamArchiveException( t );
91 typename traits::bits bits;
92 BOOST_STATIC_ASSERT(
sizeof(bits) ==
sizeof(T));
93 BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_iec559 );
96 switch( fp::fpclassify( t ))
102 bits = traits::exponent | traits::mantissa;
105 bits = traits::exponent | (t<0) * traits::sign;
108 assert( std::numeric_limits<T>::has_denorm );
110 traits::get_bits(t, bits);
113 throw DataStreamArchiveException( t );