My Project  v0.0.16
Utilities.hxx
Go to the documentation of this file.
1 #ifndef __mp7_helpers_hxx__
2 #define __mp7_helpers_hxx__
3 
4 namespace mp7 {
5 
6  template < typename T >
7  struct stoul {
8  BOOST_STATIC_ASSERT( (boost::is_unsigned<T>::value) );
9  T value;
10 
11  operator T( ) const {
12  return value;
13  }
14 
15  friend std::istream& operator>>(std::istream& in, stoul& out) {
16  std::string buf;
17  in>>buf;
18  out.value=strtoul(buf.c_str(), NULL, 0);
19  return in;
20  }
21  };
22 
23  template < typename T >
24  struct stol {
25  BOOST_STATIC_ASSERT( (boost::is_signed<T>::value) );
26  T value;
27 
28  operator T( ) const {
29  return value;
30  }
31 
32  friend std::istream& operator>>(std::istream& in, stol& out) {
33  std::string buf;
34  in>>buf;
35  out.value=strtol(buf.c_str(), NULL, 0);
36  return in;
37  }
38  };
39 }
40 
41 
42 #endif /* _mp7_helpers_hpp_ */
-test-ipbusaccess
Definition: AlignmentNode.hpp:15
T value
Definition: Utilities.hxx:9
friend std::istream& operator>>(std::istream& in, stoul& out)
Definition: Utilities.hxx:15
friend std::istream& operator>>(std::istream& in, stol& out)
Definition: Utilities.hxx:32
T value
Definition: Utilities.hxx:26
BOOST_STATIC_ASSERT( (boost::is_unsigned<T>::value) )
buf
Definition: test-buffers-demux.py:99