StringIOIndex.inl
Go to the documentation of this file.
1 namespace iv
2 {
3 
4 template< class Type >
5 std::any StringIOIndex::DoRead( std::type_index, const char * source, Context const * context )
6 {
7  Type t = StringIO_Read< Type >( source, context );
8  return std::any( t );
9 }
10 
11 template< class Type >
12 std::string StringIOIndex::DoWrite( std::any const & value, Context const * context )
13 {
14  return StringIO_Write< Type >( std::any_cast< Type >( value ), context );
15 }
16 
17 template< class T >
19 {
20  Register_Impl( (typename std::decay< T >::type*)nullptr );
21 }
22 
23 template< class T >
24 void StringIOIndex::Register_Impl( T * )
25 {
26  using TDecayed = typename std::decay< T >::type;
27 
28  auto & handler = handlers()[ typeid( TDecayed ) ];
29 
30  handler.read = &DoRead< TDecayed >;
31  handler.write = &DoWrite< TDecayed >;
32 }
33 
34 }