Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Fixed fc::array pack/unpack to work for fundemental and non-fundement…
Browse files Browse the repository at this point in the history
…al types. GH #2350
  • Loading branch information
brianjohnson5972 committed Apr 16, 2018
1 parent 60b3b78 commit 50ceb9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libraries/fc/include/fc/io/raw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ namespace fc {

template<typename Stream, typename T, size_t N>
inline void pack( Stream& s, const fc::array<T,N>& v) {
s.write((const char*)&v.data[0],N*sizeof(T));
for (uint64_t i = 0; i < N; ++i)
fc::raw::pack(s, v.data[i]);
}

template<typename Stream, typename T>
Expand All @@ -154,7 +155,8 @@ namespace fc {
template<typename Stream, typename T, size_t N>
inline void unpack( Stream& s, fc::array<T,N>& v)
{ try {
s.read((char*)&v.data[0],N*sizeof(T));
for (uint64_t i = 0; i < N; ++i)
fc::raw::unpack(s, v.data[i]);
} FC_RETHROW_EXCEPTIONS( warn, "fc::array<type,length>", ("type",fc::get_typename<T>::name())("length",N) ) }

template<typename Stream, typename T>
Expand Down

0 comments on commit 50ceb9c

Please sign in to comment.