adding raw::pack_size() helper
This commit is contained in:
parent
b5828dc750
commit
6b9abdf272
2 changed files with 8 additions and 0 deletions
|
|
@ -403,6 +403,13 @@ namespace fc {
|
|||
fc::raw::detail::if_reflected< typename fc::reflector<T>::is_defined >::unpack(s,v);
|
||||
} FC_RETHROW_EXCEPTIONS( warn, "error unpacking ${type}", ("type",fc::get_typename<T>::name() ) ) }
|
||||
|
||||
template<typename T>
|
||||
inline size_t pack_size( const T& v )
|
||||
{
|
||||
datastream<size_t> ps;
|
||||
raw::pack(ps,v );
|
||||
return ps.tellp();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline std::vector<char> pack( const T& v ) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ namespace fc {
|
|||
microseconds& operator+=(const microseconds& c) { _count += c._count; return *this; }
|
||||
microseconds& operator-=(const microseconds& c) { _count -= c._count; return *this; }
|
||||
int64_t count()const { return _count; }
|
||||
int64_t to_seconds()const { return _count/1000000; }
|
||||
private:
|
||||
friend class time_point;
|
||||
int64_t _count;
|
||||
|
|
|
|||
Loading…
Reference in a new issue