Skip to content

Commit

Permalink
size_type now specified by macro CEREAL_SIZE_TYPE
Browse files Browse the repository at this point in the history
resolves USCiLab#379
  • Loading branch information
AzothAmmo committed Feb 8, 2017
1 parent ee17db5 commit a917374
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/cereal/details/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ namespace cereal
//! The size type used by cereal
/*! To ensure compatability between 32, 64, etc bit machines, we need to use
a fixed size type instead of size_t, which may vary from machine to
machine. */
using size_type = uint64_t;
machine.
The default value for CEREAL_SIZE_TYPE is specified in cereal/macros.hpp */
using size_type = CEREAL_SIZE_TYPE;

// forward decls
class BinaryOutputArchive;
Expand Down
14 changes: 14 additions & 0 deletions include/cereal/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@
#define CEREAL_THREAD_SAFE 0
#endif // CEREAL_THREAD_SAFE

#ifndef CEREAL_SIZE_TYPE
//! Determines the data type used for size_type
/*! cereal uses size_type to ensure that the serialized size of
dynamic containers is compatible across different architectures
(e.g. 32 vs 64 bit), which may use different underlying types for
std::size_t.
More information can be found in cereal/details/helpers.hpp.
If you choose to modify this type, ensure that you use a fixed
size type (e.g. uint32_t). */
#define CEREAL_SIZE_TYPE uint64_t
#endif // CEREAL_SIZE_TYPE

// ######################################################################
#ifndef CEREAL_SERIALIZE_FUNCTION_NAME
//! The serialization/deserialization function name to search for.
Expand Down

0 comments on commit a917374

Please sign in to comment.