Merge branch 'vs2012' into develop

Conflicts:
	performance.cpp
This commit is contained in:
Shane Grant
2013-07-22 10:33:14 -07:00
49 changed files with 2221 additions and 802 deletions

18
.gitignore vendored
View File

@@ -12,6 +12,17 @@
*.la *.la
*.a *.a
# Visual studio cruft
*.opensdf
*.sdf
*.suo
*.user
*/x64
*/Debug*
*/Release*
*.log
*.tlog*
out.txt out.txt
ptr.txt ptr.txt
test.txt test.txt
@@ -19,10 +30,11 @@ unittests
boost_serialize boost_serialize
arr.txt arr.txt
performance performance
sandbox ./sandbox
sandbox_rtti ./sandbox_rtti
sandbox_json ./sandbox_json
include_renamed include_renamed
.ycm_extra_conf.py* .ycm_extra_conf.py*
doc/html doc/html
rtti.txt
doc/latex doc/latex

View File

@@ -13,6 +13,9 @@ sandbox_json: sandbox_json.cpp
sandbox_rtti: sandbox_rtti.cpp sandbox_rtti: sandbox_rtti.cpp
${CC} sandbox_rtti.cpp -o sandbox_rtti ${CPPFLAGS} -O3 ${CC} sandbox_rtti.cpp -o sandbox_rtti ${CPPFLAGS} -O3
sandbox_vs: sandbox_vs.cpp
${CC} sandbox_vs.cpp -o sandbox_vs ${CPPFLAGS}
unittests: unittests.cpp unittests: unittests.cpp
${CC} unittests.cpp -o unittests -lboost_unit_test_framework ${CPPFLAGS} ${CC} unittests.cpp -o unittests -lboost_unit_test_framework ${CPPFLAGS}
./unittests --show_progress ./unittests --show_progress

View File

@@ -30,6 +30,7 @@
#define CEREAL_ACCESS_HPP_ #define CEREAL_ACCESS_HPP_
#include <type_traits> #include <type_traits>
#include <iostream>
namespace cereal namespace cereal
{ {
@@ -109,21 +110,20 @@ namespace cereal
{ {
public: public:
template<class Archive, class T> inline template<class Archive, class T> inline
static auto member_serialize(Archive & ar, T & t) -> decltype(t.serialize(ar)) static auto member_serialize(Archive & ar, T & t) -> decltype(t.serialize(ar))
{ t.serialize(ar); } { t.serialize(ar); }
template<class Archive, class T> inline template<class Archive, class T> inline
static auto member_save(Archive & ar, T const & t) -> decltype(t.save(ar)) static auto member_save(Archive & ar, T const & t) -> decltype(t.save(ar))
{ t.save(ar); } { t.save(ar); }
// Used during detection of non const member save
template<class Archive, class T> inline
static auto non_const_member_save(Archive & ar, T & t) -> decltype(t.save(ar))
{ t.save(ar); }
template<class Archive, class T> inline template<class Archive, class T> inline
static auto member_load(Archive & ar, T & t) -> decltype(t.load(ar)) static auto member_save_non_const(Archive & ar, T & t) -> decltype(t.save(ar))
{ t.load(ar); } { t.save(ar); }
template<class Archive, class T> inline
static auto member_load(Archive & ar, T & t) -> decltype(t.load(ar))
{ t.load(ar); }
template <class T> template <class T>
static void load_and_allocate(...) static void load_and_allocate(...)

View File

@@ -53,12 +53,12 @@ namespace cereal
BinaryOutputArchive(std::ostream & stream) : BinaryOutputArchive(std::ostream & stream) :
OutputArchive<BinaryOutputArchive, AllowEmptyClassElision>(this), OutputArchive<BinaryOutputArchive, AllowEmptyClassElision>(this),
itsStream(stream) itsStream(stream)
{ } { }
//! Writes size bytes of data to the output stream //! Writes size bytes of data to the output stream
void saveBinary( const void * data, size_t size ) void saveBinary( const void * data, std::size_t size )
{ {
size_t const writtenSize = itsStream.rdbuf()->sputn( reinterpret_cast<const char*>( data ), size ); auto const writtenSize = static_cast<std::size_t>( itsStream.rdbuf()->sputn( reinterpret_cast<const char*>( data ), size ) );
if(writtenSize != size) if(writtenSize != size)
throw Exception("Failed to write " + std::to_string(size) + " bytes to output stream! Wrote " + std::to_string(writtenSize)); throw Exception("Failed to write " + std::to_string(size) + " bytes to output stream! Wrote " + std::to_string(writtenSize));
@@ -85,9 +85,9 @@ namespace cereal
{ } { }
//! Reads size bytes of data from the input stream //! Reads size bytes of data from the input stream
void loadBinary( void * const data, size_t size ) void loadBinary( void * const data, std::size_t size )
{ {
size_t const readSize = itsStream.rdbuf()->sgetn( reinterpret_cast<char*>( data ), size ); auto const readSize = static_cast<std::size_t>( itsStream.rdbuf()->sgetn( reinterpret_cast<char*>( data ), size ) );
if(readSize != size) if(readSize != size)
throw Exception("Failed to read " + std::to_string(size) + " bytes from input stream! Read " + std::to_string(readSize)); throw Exception("Failed to read " + std::to_string(size) + " bytes from input stream! Read " + std::to_string(readSize));
@@ -136,14 +136,14 @@ namespace cereal
template <class T> inline template <class T> inline
void save(BinaryOutputArchive & ar, BinaryData<T> const & bd) void save(BinaryOutputArchive & ar, BinaryData<T> const & bd)
{ {
ar.saveBinary(bd.data, bd.size); ar.saveBinary( bd.data, static_cast<std::size_t>( bd.size ) );
} }
//! Loading binary data //! Loading binary data
template <class T> inline template <class T> inline
void load(BinaryInputArchive & ar, BinaryData<T> & bd) void load(BinaryInputArchive & ar, BinaryData<T> & bd)
{ {
ar.loadBinary(bd.data, bd.size); ar.loadBinary(bd.data, static_cast<std::size_t>(bd.size));
} }
} // namespace cereal } // namespace cereal

View File

@@ -98,24 +98,45 @@ namespace cereal
itsWriter.EndObject(); itsWriter.EndObject();
} }
void saveValue(bool b) { itsWriter.Bool(b); } void saveValue(bool b) { itsWriter.Bool(b); }
void saveValue(int i) { itsWriter.Int(i); } void saveValue(int i) { itsWriter.Int(i); }
void saveValue(unsigned u) { itsWriter.Uint(u); } void saveValue(unsigned u) { itsWriter.Uint(u); }
void saveValue(int64_t i64) { itsWriter.Int64(i64); } void saveValue(int64_t i64) { itsWriter.Int64(i64); }
void saveValue(uint64_t u64) { itsWriter.Uint64(u64); } void saveValue(uint64_t u64) { itsWriter.Uint64(u64); }
void saveValue(double d) { itsWriter.Double(d); } void saveValue(double d) { itsWriter.Double(d); }
void saveValue(std::string const & s) { itsWriter.String(s.c_str(), s.size()); } void saveValue(std::string const & s) { itsWriter.String(s.c_str(), static_cast<rapidjson::SizeType>( s.size() )); }
void saveValue(char const * s) { itsWriter.String(s); } void saveValue(char const * s) { itsWriter.String(s); }
#ifdef _MSC_VER
// Visual Studio has problems disambiguating the above for unsigned long, so we provide an explicit
// overload for long and serialize it as its size necessitates
//
// When loading we don't need to do this specialization since we catch the types with
// templates according to their size
//! 32 bit long saving
template <class T> inline
typename std::enable_if<sizeof(T) == sizeof(std::uint32_t), void>::type
saveLong(T lu){ saveValue( static_cast<std::uint32_t>( lu ) ); }
//! non 32 bit long saving
template <class T> inline
typename std::enable_if<sizeof(T) != sizeof(std::uint32_t), void>::type
saveLong(T lu){ saveValue( static_cast<std::uint64_t>( lu ) ); }
//! MSVC only long overload
void saveValue( unsigned long lu ){ saveLong( lu ); };
#endif
//! Save exotic arithmetic types as binary //! Save exotic arithmetic types as binary
template<class T> template<class T>
typename std::enable_if<std::is_arithmetic<T>::value && typename std::enable_if<std::is_arithmetic<T>::value &&
(sizeof(T) >= sizeof(long double) || sizeof(T) >= sizeof(long long)), void>::type (sizeof(T) >= sizeof(long double) || sizeof(T) >= sizeof(long long)), void>::type
saveValue(T const & t) saveValue(T const & t)
{ {
auto base64string = base64::encode( reinterpret_cast<const unsigned char *>( &t ), sizeof(T) ); auto base64string = base64::encode( reinterpret_cast<const unsigned char *>( &t ), sizeof(T) );
saveValue( base64string ); saveValue( base64string );
} }
//! Write the name of the upcoming node and prepare object/array state //! Write the name of the upcoming node and prepare object/array state
/*! Since writeName is called for every value that is output, regardless of /*! Since writeName is called for every value that is output, regardless of
@@ -325,7 +346,7 @@ namespace cereal
void loadValue(bool & val) { val = itsValueStack.back().value().GetBool(); ++itsValueStack.back(); } void loadValue(bool & val) { val = itsValueStack.back().value().GetBool(); ++itsValueStack.back(); }
void loadValue(int64_t & val) { val = itsValueStack.back().value().GetInt64(); ++itsValueStack.back(); } void loadValue(int64_t & val) { val = itsValueStack.back().value().GetInt64(); ++itsValueStack.back(); }
void loadValue(uint64_t & val) { val = itsValueStack.back().value().GetUint64(); ++itsValueStack.back(); } void loadValue(uint64_t & val) { val = itsValueStack.back().value().GetUint64(); ++itsValueStack.back(); }
void loadValue(float & val) { val = itsValueStack.back().value().GetDouble(); ++itsValueStack.back(); } void loadValue(float & val) { val = static_cast<float>(itsValueStack.back().value().GetDouble()); ++itsValueStack.back(); }
void loadValue(double & val) { val = itsValueStack.back().value().GetDouble(); ++itsValueStack.back(); } void loadValue(double & val) { val = itsValueStack.back().value().GetDouble(); ++itsValueStack.back(); }
void loadValue(std::string & val) { val = itsValueStack.back().value().GetString(); ++itsValueStack.back(); } void loadValue(std::string & val) { val = itsValueStack.back().value().GetString(); ++itsValueStack.back(); }
@@ -358,7 +379,7 @@ namespace cereal
}; };
//! Loads the size for a SizeTag //! Loads the size for a SizeTag
void loadSize(size_t & size) void loadSize(size_type & size)
{ {
size = (itsValueStack.rbegin() + 1)->value().Size(); size = (itsValueStack.rbegin() + 1)->value().Size();
} }

View File

@@ -42,17 +42,17 @@ namespace cereal
inline bool is_little_endian() inline bool is_little_endian()
{ {
static std::int32_t test = 1; static std::int32_t test = 1;
return *reinterpret_cast<std::int8_t*>( &test ); return *reinterpret_cast<std::int8_t*>( &test ) == 1;
} }
//! Swaps the order of bytes for some chunk of memory //! Swaps the order of bytes for some chunk of memory
/*! @param data The data as a uint8_t pointer /*! @param data The data as a uint8_t pointer
@tparam DataSize The true size of the data @tparam DataSize The true size of the data
@ingroup Internal */ @ingroup Internal */
template <size_t DataSize> template <std::size_t DataSize>
inline void swap_bytes( std::uint8_t * data ) inline void swap_bytes( std::uint8_t * data )
{ {
for( size_t i = 0, end = DataSize / 2; i < end; ++i ) for( std::size_t i = 0, end = DataSize / 2; i < end; ++i )
std::swap( data[i], data[DataSize - i - 1] ); std::swap( data[i], data[DataSize - i - 1] );
} }
} // end namespace portable_binary_detail } // end namespace portable_binary_detail
@@ -85,9 +85,9 @@ namespace cereal
} }
//! Writes size bytes of data to the output stream //! Writes size bytes of data to the output stream
void saveBinary( const void * data, size_t size ) void saveBinary( const void * data, std::size_t size )
{ {
size_t const writtenSize = itsStream.rdbuf()->sputn( reinterpret_cast<const char*>( data ), size ); auto const writtenSize = static_cast<std::size_t>( itsStream.rdbuf()->sputn( reinterpret_cast<const char*>( data ), size ) );
if(writtenSize != size) if(writtenSize != size)
throw Exception("Failed to write " + std::to_string(size) + " bytes to output stream! Wrote " + std::to_string(writtenSize)); throw Exception("Failed to write " + std::to_string(size) + " bytes to output stream! Wrote " + std::to_string(writtenSize));
@@ -138,11 +138,11 @@ namespace cereal
/*! @param data The data to save /*! @param data The data to save
@param size The number of bytes in the data @param size The number of bytes in the data
@tparam DataSize T The size of the actual type of the data elements being loaded */ @tparam DataSize T The size of the actual type of the data elements being loaded */
template <size_t DataSize> template <std::size_t DataSize>
void loadBinary( void * const data, size_t size ) void loadBinary( void * const data, std::size_t size )
{ {
// load data // load data
size_t const readSize = itsStream.rdbuf()->sgetn( reinterpret_cast<char*>( data ), size ); auto const readSize = static_cast<std::size_t>( itsStream.rdbuf()->sgetn( reinterpret_cast<char*>( data ), size ) );
if(readSize != size) if(readSize != size)
throw Exception("Failed to read " + std::to_string(size) + " bytes from input stream! Read " + std::to_string(readSize)); throw Exception("Failed to read " + std::to_string(size) + " bytes from input stream! Read " + std::to_string(readSize));
@@ -151,7 +151,7 @@ namespace cereal
if( itsConvertEndianness ) if( itsConvertEndianness )
{ {
std::uint8_t * ptr = reinterpret_cast<std::uint8_t*>( data ); std::uint8_t * ptr = reinterpret_cast<std::uint8_t*>( data );
for( size_t i = 0; i < size; i += DataSize ) for( std::size_t i = 0; i < size; i += DataSize )
portable_binary_detail::swap_bytes<DataSize>( ptr ); portable_binary_detail::swap_bytes<DataSize>( ptr );
} }
} }
@@ -211,7 +211,7 @@ namespace cereal
(std::is_floating_point<TT>::value && std::numeric_limits<TT>::is_iec559), (std::is_floating_point<TT>::value && std::numeric_limits<TT>::is_iec559),
"Portable binary only supports IEEE 754 standardized floating point" ); "Portable binary only supports IEEE 754 standardized floating point" );
ar.saveBinary(bd.data, bd.size); ar.saveBinary( bd.data, static_cast<std::size_t>( bd.size ) );
} }
//! Loading binary data from portable binary //! Loading binary data from portable binary
@@ -223,7 +223,7 @@ namespace cereal
(std::is_floating_point<TT>::value && std::numeric_limits<TT>::is_iec559), (std::is_floating_point<TT>::value && std::numeric_limits<TT>::is_iec559),
"Portable binary only supports IEEE 754 standardized floating point" ); "Portable binary only supports IEEE 754 standardized floating point" );
ar.template loadBinary<sizeof(TT)>(bd.data, bd.size); ar.template loadBinary<sizeof(TT)>( bd.data, static_cast<std::size_t>( bd.size ) );
} }
} // namespace cereal } // namespace cereal

View File

@@ -155,7 +155,7 @@ namespace cereal
template <class T> inline template <class T> inline
void saveValue( T const & value ) void saveValue( T const & value )
{ {
itsOS.clear(); itsOS.seekp(0); itsOS.clear(); itsOS.seekp( 0, std::ios::beg );
itsOS << value << std::ends; itsOS << value << std::ends;
// allocate strings for all of the data in the XML object // allocate strings for all of the data in the XML object
@@ -286,7 +286,7 @@ namespace cereal
itsData.push_back('\0'); // rapidxml will do terrible things without the data being null terminated itsData.push_back('\0'); // rapidxml will do terrible things without the data being null terminated
itsXML.parse<rapidxml::parse_no_data_nodes | rapidxml::parse_declaration_node>( reinterpret_cast<char *>( itsData.data() ) ); itsXML.parse<rapidxml::parse_no_data_nodes | rapidxml::parse_declaration_node>( reinterpret_cast<char *>( itsData.data() ) );
} }
catch( rapidxml::parse_error const & e ) catch( rapidxml::parse_error const & )
{ {
//std::cerr << "-----Original-----" << std::endl; //std::cerr << "-----Original-----" << std::endl;
//stream.seekg(0); //stream.seekg(0);
@@ -337,7 +337,7 @@ namespace cereal
typename std::enable_if<std::is_unsigned<T>::value && !std::is_same<T, bool>::value && sizeof(T) < sizeof(long long), void>::type typename std::enable_if<std::is_unsigned<T>::value && !std::is_same<T, bool>::value && sizeof(T) < sizeof(long long), void>::type
loadValue( T & value ) loadValue( T & value )
{ {
value = std::stoul( itsNodes.top().node->value() ); value = static_cast<T>( std::stoul( itsNodes.top().node->value() ) );
} }
//! Loads a type best represented as an unsigned long long //! Loads a type best represented as an unsigned long long
@@ -345,7 +345,7 @@ namespace cereal
typename std::enable_if<std::is_unsigned<T>::value && !std::is_same<T, bool>::value && sizeof(T) >= sizeof(long long), void>::type typename std::enable_if<std::is_unsigned<T>::value && !std::is_same<T, bool>::value && sizeof(T) >= sizeof(long long), void>::type
loadValue( T & value ) loadValue( T & value )
{ {
value = std::stoull( itsNodes.top().node->value() ); value = static_cast<T>( std::stoull( itsNodes.top().node->value() ) );
} }
//! Loads a type best represented as an int //! Loads a type best represented as an int
@@ -353,7 +353,7 @@ namespace cereal
typename std::enable_if<std::is_signed<T>::value && sizeof(T) <= sizeof(int), void>::type typename std::enable_if<std::is_signed<T>::value && sizeof(T) <= sizeof(int), void>::type
loadValue( T & value ) loadValue( T & value )
{ {
value = std::stoi( itsNodes.top().node->value() ); value = static_cast<T>( std::stoi( itsNodes.top().node->value() ) );
} }
//! Loads a type best represented as a long //! Loads a type best represented as a long
@@ -361,7 +361,7 @@ namespace cereal
typename std::enable_if<std::is_signed<T>::value && (sizeof(T) > sizeof(int)) && (sizeof(T) <= sizeof(long)), void>::type typename std::enable_if<std::is_signed<T>::value && (sizeof(T) > sizeof(int)) && (sizeof(T) <= sizeof(long)), void>::type
loadValue( T & value ) loadValue( T & value )
{ {
value = std::stol( itsNodes.top().node->value() ); value = static_cast<T>( std::stol( itsNodes.top().node->value() ) );
} }
//! Loads a type best represented as a long long //! Loads a type best represented as a long long
@@ -369,7 +369,7 @@ namespace cereal
typename std::enable_if<std::is_signed<T>::value && (sizeof(T) > sizeof(long)) && (sizeof(T) <= sizeof(long long)), void>::type typename std::enable_if<std::is_signed<T>::value && (sizeof(T) > sizeof(long)) && (sizeof(T) <= sizeof(long long)), void>::type
loadValue( T & value ) loadValue( T & value )
{ {
value = std::stoll( itsNodes.top().node->value() ); value = static_cast<T>( std::stoll( itsNodes.top().node->value() ) );
} }
//! Loads a type best represented as a float //! Loads a type best represented as a float

View File

@@ -269,8 +269,8 @@ namespace cereal
//! Member serialization //! Member serialization
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_member_serialize<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_member_serialize<T, ArchiveType>::value ||
(traits::is_output_serializable<T, ArchiveType>() && traits::has_member_serialize<T, ArchiveType>()), (traits::is_output_serializable<T, ArchiveType>::value && traits::has_member_serialize<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T const & t) processImpl(T const & t)
{ {
@@ -280,8 +280,8 @@ namespace cereal
//! Non member serialization //! Non member serialization
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_non_member_serialize<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_non_member_serialize<T, ArchiveType>::value ||
(traits::is_output_serializable<T, ArchiveType>() && traits::has_non_member_serialize<T, ArchiveType>()), (traits::is_output_serializable<T, ArchiveType>::value && traits::has_non_member_serialize<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T const & t) processImpl(T const & t)
{ {
@@ -291,8 +291,8 @@ namespace cereal
//! Member split (save) //! Member split (save)
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_member_save<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_member_save<T, ArchiveType>::value ||
(traits::is_output_serializable<T, ArchiveType>() && traits::has_member_save<T, ArchiveType>()), (traits::is_output_serializable<T, ArchiveType>::value && traits::has_member_save<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T const & t) processImpl(T const & t)
{ {
@@ -302,8 +302,8 @@ namespace cereal
//! Non member split (save) //! Non member split (save)
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_non_member_save<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_non_member_save<T, ArchiveType>::value ||
(traits::is_output_serializable<T, ArchiveType>() && traits::has_non_member_save<T, ArchiveType>()), (traits::is_output_serializable<T, ArchiveType>::value && traits::has_non_member_save<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T const & t) processImpl(T const & t)
{ {
@@ -314,7 +314,7 @@ namespace cereal
//! Empty class specialization //! Empty class specialization
template <class T> inline template <class T> inline
typename std::enable_if<(Flags & AllowEmptyClassElision) && typename std::enable_if<(Flags & AllowEmptyClassElision) &&
!traits::is_output_serializable<T, ArchiveType>() && traits::is_empty_class<T>(), ArchiveType &>::type !traits::is_output_serializable<T, ArchiveType>::value && std::is_empty<T>::value, ArchiveType &>::type
processImpl(T const &) processImpl(T const &)
{ {
return *self; return *self;
@@ -322,12 +322,12 @@ namespace cereal
//! No matching serialization //! No matching serialization
template <class T> inline template <class T> inline
typename std::enable_if<!traits::is_specialized<T, ArchiveType>() && !traits::is_output_serializable<T, ArchiveType>() && typename std::enable_if<!traits::is_specialized<T, ArchiveType>::value && !traits::is_output_serializable<T, ArchiveType>::value &&
(!(Flags & AllowEmptyClassElision) || ((Flags & AllowEmptyClassElision) && !traits::is_empty_class<T>())), (!(Flags & AllowEmptyClassElision) || ((Flags & AllowEmptyClassElision) && !std::is_empty<T>::value)),
ArchiveType &>::type ArchiveType &>::type
processImpl(T const &) processImpl(T const &)
{ {
static_assert(traits::is_output_serializable<T, ArchiveType>(), "Trying to serialize an unserializable type with an output archive.\n\n" static_assert(traits::is_output_serializable<T, ArchiveType>::value, "Trying to serialize an unserializable type with an output archive.\n\n"
"Types must either have a serialize function, or separate save/load functions (but not both).\n" "Types must either have a serialize function, or separate save/load functions (but not both).\n"
"Serialize functions generally have the following signature:\n\n" "Serialize functions generally have the following signature:\n\n"
"template<class Archive>\n" "template<class Archive>\n"
@@ -491,8 +491,8 @@ namespace cereal
//! Member serialization //! Member serialization
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_member_serialize<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_member_serialize<T, ArchiveType>::value ||
(traits::is_input_serializable<T, ArchiveType>() && traits::has_member_serialize<T, ArchiveType>()), (traits::is_input_serializable<T, ArchiveType>::value && traits::has_member_serialize<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T & t) processImpl(T & t)
{ {
@@ -502,8 +502,8 @@ namespace cereal
//! Non member serialization //! Non member serialization
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_non_member_serialize<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_non_member_serialize<T, ArchiveType>::value ||
(traits::is_input_serializable<T, ArchiveType>() && traits::has_non_member_serialize<T, ArchiveType>()), (traits::is_input_serializable<T, ArchiveType>::value && traits::has_non_member_serialize<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T & t) processImpl(T & t)
{ {
@@ -513,8 +513,8 @@ namespace cereal
//! Member split (load) //! Member split (load)
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_member_load<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_member_load<T, ArchiveType>::value ||
(traits::is_input_serializable<T, ArchiveType>() && traits::has_member_load<T, ArchiveType>()), (traits::is_input_serializable<T, ArchiveType>::value && traits::has_member_load<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T & t) processImpl(T & t)
{ {
@@ -524,8 +524,8 @@ namespace cereal
//! Non member split (load) //! Non member split (load)
template <class T> inline template <class T> inline
typename std::enable_if<traits::is_specialized_non_member_load<T, ArchiveType>() || typename std::enable_if<traits::is_specialized_non_member_load<T, ArchiveType>::value ||
(traits::is_input_serializable<T, ArchiveType>() && traits::has_non_member_load<T, ArchiveType>()), (traits::is_input_serializable<T, ArchiveType>::value && traits::has_non_member_load<T, ArchiveType>::value),
ArchiveType &>::type ArchiveType &>::type
processImpl(T & t) processImpl(T & t)
{ {
@@ -536,7 +536,7 @@ namespace cereal
//! Empty class specialization //! Empty class specialization
template <class T> inline template <class T> inline
typename std::enable_if<(Flags & AllowEmptyClassElision) && typename std::enable_if<(Flags & AllowEmptyClassElision) &&
!traits::is_input_serializable<T, ArchiveType>() && traits::is_empty_class<T>(), ArchiveType &>::type !traits::is_input_serializable<T, ArchiveType>::value && std::is_empty<T>::value, ArchiveType &>::type
processImpl(T const &) processImpl(T const &)
{ {
return *self; return *self;
@@ -544,12 +544,12 @@ namespace cereal
//! No matching serialization //! No matching serialization
template <class T> inline template <class T> inline
typename std::enable_if<!traits::is_specialized<T, ArchiveType>() && !traits::is_input_serializable<T, ArchiveType>() && typename std::enable_if<!traits::is_specialized<T, ArchiveType>::value && !traits::is_input_serializable<T, ArchiveType>::value &&
(!(Flags & AllowEmptyClassElision) || ((Flags & AllowEmptyClassElision) && !traits::is_empty_class<T>())), (!(Flags & AllowEmptyClassElision) || ((Flags & AllowEmptyClassElision) && !std::is_empty<T>::value)),
ArchiveType &>::type ArchiveType &>::type
processImpl(T const &) processImpl(T const &)
{ {
static_assert(traits::is_output_serializable<T, ArchiveType>(), "Trying to serialize an unserializable type with an output archive.\n\n" static_assert(traits::is_output_serializable<T, ArchiveType>::value, "Trying to serialize an unserializable type with an output archive.\n\n"
"Types must either have a serialize function, or separate save/load functions (but not both).\n" "Types must either have a serialize function, or separate save/load functions (but not both).\n"
"Serialize functions generally have the following signature:\n\n" "Serialize functions generally have the following signature:\n\n"
"template<class Archive>\n" "template<class Archive>\n"

View File

@@ -122,10 +122,10 @@ namespace cereal
private: private:
// If we get passed an RValue, we'll just make a local copy if it here // If we get passed an RValue, we'll just make a local copy if it here
// otherwise, we store a reference // otherwise, we store a reference
using DT = typename std::decay<T>::type; typedef typename std::decay<T>::type DT;
using Type = typename std::conditional<std::is_rvalue_reference<T>::value, typedef typename std::conditional<std::is_rvalue_reference<T>::value,
DT, DT,
typename std::add_lvalue_reference<DT>::type>::type; typename std::add_lvalue_reference<DT>::type>::type Type;
// prevent nested nvps // prevent nested nvps
static_assert( !std::is_base_of<detail::NameValuePairCore, T>::value, static_assert( !std::is_base_of<detail::NameValuePairCore, T>::value,
"Cannot pair a name to a NameValuePair" ); "Cannot pair a name to a NameValuePair" );
@@ -189,9 +189,9 @@ namespace cereal
{ {
//! Internally store the pointer as a void *, keeping const if created with //! Internally store the pointer as a void *, keeping const if created with
//! a const pointer //! a const pointer
using PT = typename std::conditional<std::is_const<typename std::remove_pointer<T>::type>::value, typedef typename std::conditional<std::is_const<typename std::remove_pointer<T>::type>::value,
const void *, const void *,
void *>::type; void *>::type PT;
BinaryData( T && d, uint64_t s ) : data(d), size(s) {} BinaryData( T && d, uint64_t s ) : data(d), size(s) {}
@@ -230,10 +230,10 @@ namespace cereal
private: private:
// If we get passed an RValue, we'll just make a local copy if it here // If we get passed an RValue, we'll just make a local copy if it here
// otherwise, we store a reference // otherwise, we store a reference
using DT = typename std::decay<T>::type; typedef typename std::decay<T>::type DT;
using Type = typename std::conditional<std::is_rvalue_reference<T>::value, typedef typename std::conditional<std::is_rvalue_reference<T>::value,
DT, DT,
typename std::add_lvalue_reference<DT>::type>::type; typename std::add_lvalue_reference<DT>::type>::type Type;
public: public:
SizeTag( T && sz ) : size(const_cast<Type>(sz)) {} SizeTag( T && sz ) : size(const_cast<Type>(sz)) {}
@@ -265,17 +265,17 @@ namespace cereal
template <class Key, class Value> template <class Key, class Value>
struct MapItem struct MapItem
{ {
using DecayKey = typename std::decay<Key>::type; typedef typename std::decay<Key>::type DecayKey;
using KeyType = typename std::conditional< typedef typename std::conditional<
std::is_rvalue_reference<Key>::value, std::is_rvalue_reference<Key>::value,
DecayKey, DecayKey,
typename std::add_lvalue_reference<DecayKey>::type>::type; typename std::add_lvalue_reference<DecayKey>::type>::type KeyType;
using DecayValue = typename std::decay<Value>::type; typedef typename std::decay<Value>::type DecayValue;
using ValueType = typename std::conditional< typedef typename std::conditional<
std::is_rvalue_reference<Value>::value, std::is_rvalue_reference<Value>::value,
DecayValue, DecayValue,
typename std::add_lvalue_reference<DecayValue>::type>::type; typename std::add_lvalue_reference<DecayValue>::type>::type ValueType;
//! Construct a MapItem from a key and a value //! Construct a MapItem from a key and a value
/*! @internal */ /*! @internal */

View File

@@ -47,6 +47,7 @@
#include <cereal/details/static_object.hpp> #include <cereal/details/static_object.hpp>
#include <cereal/types/memory.hpp> #include <cereal/types/memory.hpp>
#include <cereal/types/string.hpp> #include <cereal/types/string.hpp>
#include <functional>
#include <typeindex> #include <typeindex>
#include <map> #include <map>
@@ -64,7 +65,7 @@
}; \ }; \
bind_to_archives<T> const & init_binding<T>::b = \ bind_to_archives<T> const & init_binding<T>::b = \
::cereal::detail::StaticObject< \ ::cereal::detail::StaticObject< \
bind_to_archives<T > \ bind_to_archives<T> \
>::getInstance().bind(); \ >::getInstance().bind(); \
}} // end namespaces }} // end namespaces
@@ -242,20 +243,20 @@ namespace cereal
template <class Archive, class T> template <class Archive, class T>
struct create_bindings struct create_bindings
{ {
static const InputBindingCreator<Archive, T> & static const InputBindingCreator<Archive, T> &
load(std::true_type) load(std::true_type)
{ {
return cereal::detail::StaticObject<InputBindingCreator<Archive, T>>::getInstance(); return cereal::detail::StaticObject<InputBindingCreator<Archive, T>>::getInstance();
} }
static const OutputBindingCreator<Archive, T> & static const OutputBindingCreator<Archive, T> &
save(std::true_type) save(std::true_type)
{ {
return cereal::detail::StaticObject<OutputBindingCreator<Archive, T>>::getInstance(); return cereal::detail::StaticObject<OutputBindingCreator<Archive, T>>::getInstance();
} }
inline static void load(std::false_type) {} inline static void load(std::false_type) {}
inline static void save(std::false_type) {} inline static void save(std::false_type) {}
}; };
//! When specialized, causes the compiler to instantiate its parameter //! When specialized, causes the compiler to instantiate its parameter
@@ -270,20 +271,26 @@ namespace cereal
template <class Archive, class T> template <class Archive, class T>
struct polymorphic_serialization_support struct polymorphic_serialization_support
{ {
#ifdef _MSC_VER
//! Creates the appropriate bindings depending on whether the archive supports
//! saving or loading
virtual void instantiate();
#else // NOT _MSC_VER
//! Creates the appropriate bindings depending on whether the archive supports //! Creates the appropriate bindings depending on whether the archive supports
//! saving or loading //! saving or loading
static void instantiate(); static void instantiate();
//! This typedef causes the compiler to instantiate this static function //! This typedef causes the compiler to instantiate this static function
typedef instantiate_function<instantiate> unused; typedef instantiate_function<instantiate> unused;
#endif // _MSC_VER
}; };
// instantiate implementation // instantiate implementation
template <class Archive, class T> template <class Archive, class T>
void polymorphic_serialization_support<Archive,T>::instantiate() void polymorphic_serialization_support<Archive,T>::instantiate()
{ {
create_bindings<Archive,T>::save( std::is_base_of<detail::OutputArchiveBase, Archive>() ); create_bindings<Archive,T>::save( std::is_base_of<detail::OutputArchiveBase, Archive>() );
create_bindings<Archive,T>::load( std::is_base_of<detail::InputArchiveBase, Archive>() ); create_bindings<Archive,T>::load( std::is_base_of<detail::InputArchiveBase, Archive>() );
} }
//! Begins the binding process of a type to all registered archives //! Begins the binding process of a type to all registered archives
@@ -296,8 +303,8 @@ namespace cereal
{ {
//! Binding for non abstract types //! Binding for non abstract types
void bind(std::false_type) const void bind(std::false_type) const
{ {
instantiate_polymorphic_binding( (T*)0, 0, adl_tag{} ); instantiate_polymorphic_binding((T*) 0, 0, adl_tag{});
} }
//! Binding for abstract types //! Binding for abstract types
@@ -309,6 +316,8 @@ namespace cereal
do not need to make a binding */ do not need to make a binding */
bind_to_archives const & bind() const bind_to_archives const & bind() const
{ {
static_assert( std::is_polymorphic<T>::value,
"Attempting to register non polymorphic type" );
bind( std::is_abstract<T>() ); bind( std::is_abstract<T>() );
return *this; return *this;
} }

View File

@@ -30,6 +30,8 @@
#ifndef CEREAL_DETAILS_STATIC_OBJECT_HPP_ #ifndef CEREAL_DETAILS_STATIC_OBJECT_HPP_
#define CEREAL_DETAILS_STATIC_OBJECT_HPP_ #define CEREAL_DETAILS_STATIC_OBJECT_HPP_
#include <cereal/details/util.hpp>
namespace cereal namespace cereal
{ {
namespace detail namespace detail
@@ -47,7 +49,7 @@ namespace cereal
{ {
private: private:
//! Forces instantiation at pre-execution time //! Forces instantiation at pre-execution time
static void instantiate(T const &) {} static void instantiate( T const & ) {}
static T & create() static T & create()
{ {
@@ -56,7 +58,7 @@ namespace cereal
return t; return t;
} }
StaticObject( StaticObject const & other ) = delete; StaticObject( StaticObject const & other ) {}
public: public:
static T & getInstance() static T & getInstance()

View File

@@ -40,280 +40,263 @@ namespace cereal
{ {
namespace traits namespace traits
{ {
template<typename> struct Void { typedef void type; }; typedef std::true_type yes;
typedef std::false_type no;
//! Creates a test for whether a non const member function exists
/*! This creates a class derived from std::integral_constant that will be true if
the type has the proper member function for the given archive. */
#define CEREAL_MAKE_HAS_MEMBER_TEST(name) \
namespace detail \
{ \
template <class T, class A> \
struct has_member_##name##_impl \
{ \
template <class TT, class AA> \
static auto test(int) -> decltype( cereal::access::member_##name( std::declval<AA&>(), std::declval<TT&>() ), yes()); \
template <class, class> \
static no test(...); \
static const bool value = std::is_same<decltype(test<T, A>(0)), yes>::value; \
}; \
} /* end namespace detail */ \
template <class T, class A> \
struct has_member_##name : std::integral_constant<bool, detail::has_member_##name##_impl<T, A>::value> {};
//! Creates a test for whether a non const non-member function exists
/*! This creates a class derived from std::integral_constant that will be true if
the type has the proper non-member function for the given archive. */
#define CEREAL_MAKE_HAS_NON_MEMBER_TEST(name) \
namespace detail \
{ \
template <class T, class A> \
struct has_non_member_##name##_impl \
{ \
template <class TT, class AA> \
static auto test(int) -> decltype( name( std::declval<AA&>(), std::declval<TT&>() ), yes()); \
template <class, class> \
static no test( ... ); \
static const bool value = std::is_same<decltype( test<T, A>( 0 ) ), yes>::value; \
}; \
} /* end namespace detail */ \
template <class T, class A> \
struct has_non_member_##name : std::integral_constant<bool, detail::has_non_member_##name##_impl<T, A>::value> {};
// ###################################################################### // ######################################################################
// Member load_and_allocate // Member load_and_allocate
template<typename T, typename A> template<typename T, typename A>
bool constexpr has_member_load_and_allocate() struct has_member_load_and_allocate :
{ return std::is_same<decltype( access::load_and_allocate<T>( std::declval<A&>() ) ), T*>::value; } std::integral_constant<bool, std::is_same<decltype( access::load_and_allocate<T>( std::declval<A&>() ) ), T*>::value> {};
// ###################################################################### // ######################################################################
// Non Member load_and_allocate // Non Member load_and_allocate
template<typename T, typename A> template<typename T, typename A>
bool constexpr has_non_member_load_and_allocate() struct has_non_member_load_and_allocate : std::integral_constant<bool,
{ return std::is_same<decltype( LoadAndAllocate<T>::load_and_allocate( std::declval<A&>() ) ), T*>::value; } std::is_same<decltype( LoadAndAllocate<T>::load_and_allocate( std::declval<A&>() ) ), T*>::value> {};
// ###################################################################### // ######################################################################
// Has either a member or non member allocate // Has either a member or non member allocate
template<typename T, typename A> template<typename T, typename A>
bool constexpr has_load_and_allocate() struct has_load_and_allocate : std::integral_constant<bool,
{ return has_member_load_and_allocate<T, A>() || has_non_member_load_and_allocate<T, A>(); } has_member_load_and_allocate<T, A>::value || has_non_member_load_and_allocate<T, A>::value>
{ };
// ###################################################################### // ######################################################################
// Member Serialize // Member Serialize
template<typename T, class A, typename Sfinae = void> CEREAL_MAKE_HAS_MEMBER_TEST(serialize);
struct has_member_serialize: std::false_type {};
template<typename T, class A>
struct has_member_serialize< T, A,
typename Void<
decltype( access::member_serialize(std::declval<A&>(), std::declval<T&>() ) )
>::type
>: std::true_type {};
// ###################################################################### // ######################################################################
// Non Member Serialize // Non Member Serialize
char & serialize(...); CEREAL_MAKE_HAS_NON_MEMBER_TEST(serialize);
template<typename T, typename A>
bool constexpr has_non_member_serialize()
{ return std::is_void<decltype(serialize(std::declval<A&>(), std::declval<T&>()))>::value; };
// ###################################################################### // ######################################################################
// Member Load // Member Load
template<typename T, class A, typename Sfinae = void> CEREAL_MAKE_HAS_MEMBER_TEST(load);
struct has_member_load: std::false_type {};
template<typename T, class A>
struct has_member_load< T, A,
typename Void<
decltype( access::member_load(std::declval<A&>(), std::declval<T&>() ) )
>::type
>: std::true_type {};
// ###################################################################### // ######################################################################
// Non Member Load // Non Member Load
char & load(...); CEREAL_MAKE_HAS_NON_MEMBER_TEST(load);
template<typename T, typename A>
bool constexpr has_non_member_load()
{ return std::is_void<decltype(load(std::declval<A&>(), std::declval<T&>()))>::value; };
// ###################################################################### // ######################################################################
// Member Save // Member Save
template<typename T, class A, typename Sfinae = void> namespace detail
struct has_member_save: std::false_type {}; {
template <class T, class A>
struct has_member_save_impl
{
template <class TT, class AA>
static auto test(int) -> decltype( cereal::access::member_save( std::declval<AA&>(), std::declval<TT const &>() ), yes());
template <class, class>
static no test(...);
static const bool value = std::is_same<decltype(test<T, A>(0)), yes>::value;
template<typename T, class A> template <class TT, class AA>
struct has_member_save< T, A, static auto test2(int) -> decltype( cereal::access::member_save_non_const( std::declval<AA &>(), std::declval<typename std::remove_const<TT>::type&>() ), yes());
typename Void< template <class, class>
decltype( access::member_save(std::declval<A&>(), std::declval<T const &>() ) ) static no test2(...);
>::type static const bool not_const_type = std::is_same<decltype(test2<T, A>(0)), yes>::value;
>: std::true_type {}; };
} // end namespace detail
template <class T, class A>
struct has_member_save : std::integral_constant<bool, detail::has_member_save_impl<T, A>::value>
{
typedef typename detail::has_member_save_impl<T, A> check;
static_assert( check::value || !check::not_const_type,
"cereal detected a non-const save.\n"
"save member functions must always be const" );
};
// ###################################################################### // ######################################################################
// Non-const Member Save // Non-const Member Save
namespace detail namespace detail
{ {
// Detection of any (const or non const) member save template <class T, class A>
template<typename T, class A, typename Sfinae = void> struct has_non_member_save_impl
struct has_member_save_any: std::false_type {}; {
template <class TT, class AA>
static auto test(int) -> decltype( save( std::declval<AA&>(), std::declval<TT const &>() ), yes());
template <class, class>
static no test(...);
static const bool value = std::is_same<decltype(test<T, A>(0)), yes>::value;
template<typename T, class A> template <class TT, class AA>
struct has_member_save_any< T, A, static auto test2(int) -> decltype( save( std::declval<AA &>(), std::declval<typename std::remove_const<TT>::type&>() ), yes());
typename Void< template <class, class>
decltype( access::non_const_member_save(std::declval<A&>(), std::declval<typename std::remove_const<T>::type &>() ) ) static no test2(...);
>::type static const bool not_const_type = std::is_same<decltype(test2<T, A>(0)), yes>::value;
>: std::true_type {}; };
} } // end namespace detail
// Returns true if we detect a member save function that is not const
template <class T, class A> template <class T, class A>
constexpr bool is_non_const_member_save() struct has_non_member_save : std::integral_constant<bool, detail::has_non_member_save_impl<T, A>::value>
{ {
return !has_member_save<T, A>() && detail::has_member_save_any<T, A>(); typedef typename detail::has_non_member_save_impl<T, A> check;
} static_assert( check::value || !check::not_const_type,
"cereal detected a non-const type parameter in non-member save.\n"
// ###################################################################### "save non-member functions must always pass their types as const" );
// Non Member Save };
char & save(...);
template<typename T, typename A>
bool constexpr has_non_member_save()
{ return std::is_void<decltype(save(std::declval<A&>(), std::declval<T const &>()))>::value; }
// ######################################################################
// Non-const Non member Save
namespace detail
{
template<typename T, typename A>
bool constexpr has_non_member_save_any()
{ return std::is_void<decltype(save(std::declval<A&>(), std::declval<typename std::remove_const<T>::type &>()))>::value; }
}
// Returns true if we detect a non-member save function that is not const
template<typename T, typename A>
bool constexpr is_non_const_non_member_save()
{ return !has_non_member_save<T, A>() && detail::has_non_member_save_any<T, A>(); }
// ######################################################################
// Returns true if we have an invalid save function (non const)
template <class T, class A>
bool constexpr has_non_const_save()
{ return is_non_const_member_save<T, A>() || is_non_const_non_member_save<T, A>(); }
// ###################################################################### // ######################################################################
template <class T, class InputArchive, class OutputArchive> template <class T, class InputArchive, class OutputArchive>
constexpr bool has_member_split() struct has_member_split : std::integral_constant<bool,
{ return has_member_load<T, InputArchive>() && has_member_save<T, OutputArchive>(); } has_member_load<T, InputArchive>::value && has_member_save<T, OutputArchive>::value> {};
// ###################################################################### // ######################################################################
template <class T, class InputArchive, class OutputArchive> template <class T, class InputArchive, class OutputArchive>
constexpr bool has_non_member_split() struct has_non_member_split : std::integral_constant<bool,
{ return has_non_member_load<T, InputArchive>() && has_non_member_save<T, OutputArchive>(); } has_non_member_load<T, InputArchive>::value && has_non_member_save<T, OutputArchive>::value> {};
// ###################################################################### // ######################################################################
template <class T, class OutputArchive> template <class T, class OutputArchive>
constexpr bool is_output_serializable() struct is_output_serializable : std::integral_constant<bool,
{ has_member_save<T, OutputArchive>::value ^
static_assert( !has_non_const_save<T, OutputArchive>(), has_non_member_save<T, OutputArchive>::value ^
"cereal detected a non const save. \n " has_member_serialize<T, OutputArchive>::value ^
"save functions must either be const member functions or accept const type aguments if non-member" ); has_non_member_serialize<T, OutputArchive>::value> {};
return
has_member_save<T, OutputArchive>() ^
has_non_member_save<T, OutputArchive>() ^
has_member_serialize<T, OutputArchive>() ^
has_non_member_serialize<T, OutputArchive>();
}
// ###################################################################### // ######################################################################
template <class T, class InputArchive> template <class T, class InputArchive>
constexpr bool is_input_serializable() struct is_input_serializable : std::integral_constant<bool,
{ has_member_load<T, InputArchive>::value ^
return has_non_member_load<T, InputArchive>::value ^
has_member_load<T, InputArchive>() ^ has_member_serialize<T, InputArchive>::value ^
has_non_member_load<T, InputArchive>() ^ has_non_member_serialize<T, InputArchive>::value> {};
has_member_serialize<T, InputArchive>() ^
has_non_member_serialize<T, InputArchive>();
}
// ###################################################################### // ######################################################################
namespace detail namespace detail
{ {
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_member_serialize() -> bool struct is_specialized_member_serialize : std::integral_constant<bool,
{ return !std::is_base_of<std::false_type, specialize<A, T, specialization::member_serialize>>(); } !std::is_base_of<std::false_type, specialize<A, T, specialization::member_serialize>>::value> {};
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_member_load_save() -> bool struct is_specialized_member_load_save : std::integral_constant<bool,
{ return !std::is_base_of<std::false_type, specialize<A, T, specialization::member_load_save>>(); } !std::is_base_of<std::false_type, specialize<A, T, specialization::member_load_save>>::value> {};
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_non_member_serialize() -> bool struct is_specialized_non_member_serialize : std::integral_constant<bool,
{ return !std::is_base_of<std::false_type, specialize<A, T, specialization::non_member_serialize>>(); } !std::is_base_of<std::false_type, specialize<A, T, specialization::non_member_serialize>>::value> {};
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_non_member_load_save() -> bool struct is_specialized_non_member_load_save : std::integral_constant<bool,
{ return !std::is_base_of<std::false_type, specialize<A, T, specialization::non_member_load_save>>(); } !std::is_base_of<std::false_type, specialize<A, T, specialization::non_member_load_save>>::value> {};
// Considered an error if specialization exists for more than one type // Considered an error if specialization exists for more than one type
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_error() -> bool struct is_specialized_error : std::integral_constant<bool,
{ (is_specialized_member_serialize<T, A>::value +
return (is_specialized_member_serialize<T, A>() + is_specialized_member_load_save<T, A>::value +
is_specialized_member_load_save<T, A>() + is_specialized_non_member_serialize<T, A>::value +
is_specialized_non_member_serialize<T, A>() + is_specialized_non_member_load_save<T, A>::value) <= 1> {};
is_specialized_non_member_load_save<T, A>()) <= 1;
}
} // namespace detail } // namespace detail
template <class T, class A> template <class T, class A>
constexpr auto is_specialized() -> bool struct is_specialized : std::integral_constant<bool,
detail::is_specialized_member_serialize<T, A>::value ||
detail::is_specialized_member_load_save<T, A>::value ||
detail::is_specialized_non_member_serialize<T, A>::value ||
detail::is_specialized_non_member_load_save<T, A>::value>
{ {
static_assert(detail::is_specialized_error<T, A>(), "More than one explicit specialization detected for type."); static_assert(detail::is_specialized_error<T, A>::value, "More than one explicit specialization detected for type.");
return detail::is_specialized_member_serialize<T, A>() || };
detail::is_specialized_member_load_save<T, A>() ||
detail::is_specialized_non_member_serialize<T, A>() ||
detail::is_specialized_non_member_load_save<T, A>();
}
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_member_serialize() -> bool struct is_specialized_member_serialize : std::integral_constant<bool,
is_specialized<T, A>::value && detail::is_specialized_member_serialize<T, A>::value>
{ {
static_assert( (is_specialized<T, A>() && detail::is_specialized_member_serialize<T, A>() && has_member_serialize<T, A>()) static_assert( (is_specialized<T, A>::value && detail::is_specialized_member_serialize<T, A>::value && has_member_serialize<T, A>::value)
|| !(is_specialized<T, A>() && detail::is_specialized_member_serialize<T, A>()), || !(is_specialized<T, A>::value && detail::is_specialized_member_serialize<T, A>::value),
"cereal detected member serialization specialization but no member serialize function" ); "cereal detected member serialization specialization but no member serialize function" );
return is_specialized<T, A>() && detail::is_specialized_member_serialize<T, A>(); };
}
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_member_load() -> bool struct is_specialized_member_load : std::integral_constant<bool,
is_specialized<T, A>::value && detail::is_specialized_member_load_save<T, A>::value>
{ {
static_assert( (is_specialized<T, A>() && detail::is_specialized_member_load_save<T, A>() && has_member_load<T, A>()) static_assert( (is_specialized<T, A>::value && detail::is_specialized_member_load_save<T, A>::value && has_member_load<T, A>::value)
|| !(is_specialized<T, A>() && detail::is_specialized_member_load_save<T, A>()), || !(is_specialized<T, A>::value && detail::is_specialized_member_load_save<T, A>::value),
"cereal detected member load specialization but no member load function" ); "cereal detected member load specialization but no member load function" );
return is_specialized<T, A>() && detail::is_specialized_member_load_save<T, A>(); };
}
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_member_save() -> bool struct is_specialized_member_save : std::integral_constant<bool,
is_specialized<T, A>::value && detail::is_specialized_member_load_save<T, A>::value>
{ {
static_assert( (is_specialized<T, A>() && detail::is_specialized_member_load_save<T, A>() && has_member_save<T, A>()) static_assert( (is_specialized<T, A>::value && detail::is_specialized_member_load_save<T, A>::value && has_member_save<T, A>::value)
|| !(is_specialized<T, A>() && detail::is_specialized_member_load_save<T, A>()), || !(is_specialized<T, A>::value && detail::is_specialized_member_load_save<T, A>::value),
"cereal detected member save specialization but no member save function" ); "cereal detected member save specialization but no member save function" );
return is_specialized<T, A>() && detail::is_specialized_member_load_save<T, A>(); };
}
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_non_member_serialize() -> bool struct is_specialized_non_member_serialize : std::integral_constant<bool,
is_specialized<T, A>::value && detail::is_specialized_non_member_serialize<T, A>::value>
{ {
static_assert( (is_specialized<T, A>() && detail::is_specialized_non_member_serialize<T, A>() && has_non_member_serialize<T, A>()) static_assert( (is_specialized<T, A>::value && detail::is_specialized_non_member_serialize<T, A>::value && has_non_member_serialize<T, A>::value)
|| !(is_specialized<T, A>() && detail::is_specialized_non_member_serialize<T, A>()), || !(is_specialized<T, A>::value && detail::is_specialized_non_member_serialize<T, A>::value),
"cereal detected non-member serialization specialization but no non-member serialize function" ); "cereal detected non-member serialization specialization but no non-member serialize function" );
return is_specialized<T, A>() && detail::is_specialized_non_member_serialize<T, A>(); };
}
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_non_member_load() -> bool struct is_specialized_non_member_load : std::integral_constant<bool,
is_specialized<T, A>::value && detail::is_specialized_non_member_load_save<T, A>::value>
{ {
static_assert( (is_specialized<T, A>() && detail::is_specialized_non_member_load_save<T, A>() && has_non_member_load<T, A>()) static_assert( (is_specialized<T, A>::value && detail::is_specialized_non_member_load_save<T, A>::value && has_non_member_load<T, A>::value)
|| !(is_specialized<T, A>() && detail::is_specialized_non_member_load_save<T, A>()), || !(is_specialized<T, A>::value && detail::is_specialized_non_member_load_save<T, A>::value),
"cereal detected non-member load specialization but no non-member load function" ); "cereal detected non-member load specialization but no non-member load function" );
return is_specialized<T, A>() && detail::is_specialized_non_member_load_save<T, A>(); };
}
template <class T, class A> template <class T, class A>
constexpr auto is_specialized_non_member_save() -> bool struct is_specialized_non_member_save : std::integral_constant<bool,
is_specialized<T, A>::value && detail::is_specialized_non_member_load_save<T, A>::value>
{ {
static_assert( (is_specialized<T, A>() && detail::is_specialized_non_member_load_save<T, A>() && has_non_member_save<T, A>()) static_assert( (is_specialized<T, A>::value && detail::is_specialized_non_member_load_save<T, A>::value && has_non_member_save<T, A>::value)
|| !(is_specialized<T, A>() && detail::is_specialized_non_member_load_save<T, A>()), || !(is_specialized<T, A>::value && detail::is_specialized_non_member_load_save<T, A>::value),
"cereal detected non-member save specialization but no non-member save function" ); "cereal detected non-member save specialization but no non-member save function" );
return is_specialized<T, A>() && detail::is_specialized_non_member_load_save<T, A>(); };
}
// ######################################################################
template <class T>
constexpr size_t sizeof_array( size_t rank = std::rank<T>::value )
{
return rank == 0 ? 1 : std::extent<T>::value * sizeof_array<typename std::remove_extent<T>::type>( rank - 1 );
}
// ###################################################################### // ######################################################################
namespace detail namespace detail
{ {
template <class T, typename Enable = void>
struct is_empty_class_impl
{ static constexpr bool value = false; };
template <class T>
struct is_empty_class_impl<T, typename std::enable_if<std::is_class<T>::value>::type>
{
struct S : T
{ uint8_t t; };
static constexpr bool value = sizeof(S) == sizeof(uint8_t);
};
struct base_class_id struct base_class_id
{ {
template<class T> template<class T>
@@ -331,10 +314,8 @@ namespace cereal
size_t hash; size_t hash;
}; };
struct base_class_id_hash { size_t operator()(base_class_id const & id) const { return id.hash; } }; struct base_class_id_hash { size_t operator()(base_class_id const & id) const { return id.hash; } };
} } // namespace detail
template<class T>
using is_empty_class = std::integral_constant<bool, detail::is_empty_class_impl<T>::value>;
// ###################################################################### // ######################################################################
//! A macro to use to restrict which types of archives your function will work for. //! A macro to use to restrict which types of archives your function will work for.
@@ -361,9 +342,10 @@ namespace cereal
typename std::enable_if<std::is_same<Archive, INTYPE>::value || std::is_same<Archive, OUTTYPE>::value, void>::type typename std::enable_if<std::is_same<Archive, INTYPE>::value || std::is_same<Archive, OUTTYPE>::value, void>::type
} // namespace traits } // namespace traits
// ######################################################################
namespace detail namespace detail
{ {
template <class T, class A, bool Member = traits::has_member_load_and_allocate<T, A>(), bool NonMember = traits::has_non_member_load_and_allocate<T, A>()> template <class T, class A, bool Member = traits::has_member_load_and_allocate<T, A>::value, bool NonMember = traits::has_non_member_load_and_allocate<T, A>::value>
struct Load struct Load
{ {
static_assert( !sizeof(T), "Cereal detected both member and non member load_and_allocate functions!" ); static_assert( !sizeof(T), "Cereal detected both member and non member load_and_allocate functions!" );

View File

@@ -31,9 +31,31 @@
#define CEREAL_DETAILS_UTIL_HPP_ #define CEREAL_DETAILS_UTIL_HPP_
#include <typeinfo> #include <typeinfo>
#include <cxxabi.h>
#include <string> #include <string>
#ifdef _MSC_VER
namespace cereal
{
namespace util
{
//! Demangles the type encoded in a string
/*! @internal */
inline std::string demangle( std::string const & name )
{
return name;
}
//! Gets the demangled name of a type
/*! @internal */
template <class T> inline
std::string demangledName()
{
return typeid( T ).name();
}
} // namespace util
} // namespace cereal
#else // clang or gcc
#include <cxxabi.h>
namespace cereal namespace cereal
{ {
namespace util namespace util
@@ -60,6 +82,9 @@ namespace cereal
std::string demangledName() std::string demangledName()
{ return demangle(typeid(T).name()); } { return demangle(typeid(T).name()); }
} }
} } // namespace cereal
#endif
#endif // CEREAL_DETAILS_UTIL_HPP_ #endif // CEREAL_DETAILS_UTIL_HPP_

View File

@@ -39,7 +39,7 @@ namespace base64
return (isalnum(c) || (c == '+') || (c == '/')); return (isalnum(c) || (c == '+') || (c == '/'));
} }
inline std::string encode(unsigned char const* bytes_to_encode, unsigned int in_len) { inline std::string encode(unsigned char const* bytes_to_encode, size_t in_len) {
std::string ret; std::string ret;
int i = 0; int i = 0;
int j = 0; int j = 0;
@@ -49,10 +49,10 @@ namespace base64
while (in_len--) { while (in_len--) {
char_array_3[i++] = *(bytes_to_encode++); char_array_3[i++] = *(bytes_to_encode++);
if (i == 3) { if (i == 3) {
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2; char_array_4[0] = (unsigned char) ((char_array_3[0] & 0xfc) >> 2);
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4); char_array_4[1] = (unsigned char) ( ( ( char_array_3[0] & 0x03 ) << 4 ) + ( ( char_array_3[1] & 0xf0 ) >> 4 ) );
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6); char_array_4[2] = (unsigned char) ( ( ( char_array_3[1] & 0x0f ) << 2 ) + ( ( char_array_3[2] & 0xc0 ) >> 6 ) );
char_array_4[3] = char_array_3[2] & 0x3f; char_array_4[3] = (unsigned char) ( char_array_3[2] & 0x3f );
for(i = 0; (i <4) ; i++) for(i = 0; (i <4) ; i++)
ret += chars[char_array_4[i]]; ret += chars[char_array_4[i]];
@@ -83,9 +83,9 @@ namespace base64
} }
inline std::string decode(std::string const& encoded_string) { inline std::string decode(std::string const& encoded_string) {
int in_len = encoded_string.size(); size_t in_len = encoded_string.size();
int i = 0; size_t i = 0;
int j = 0; size_t j = 0;
int in_ = 0; int in_ = 0;
unsigned char char_array_4[4], char_array_3[3]; unsigned char char_array_4[4], char_array_3[3];
std::string ret; std::string ret;
@@ -94,7 +94,7 @@ namespace base64
char_array_4[i++] = encoded_string[in_]; in_++; char_array_4[i++] = encoded_string[in_]; in_++;
if (i ==4) { if (i ==4) {
for (i = 0; i <4; i++) for (i = 0; i <4; i++)
char_array_4[i] = chars.find(char_array_4[i]); char_array_4[i] = (unsigned char) chars.find( char_array_4[i] );
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
@@ -111,7 +111,7 @@ namespace base64
char_array_4[j] = 0; char_array_4[j] = 0;
for (j = 0; j <4; j++) for (j = 0; j <4; j++)
char_array_4[j] = chars.find(char_array_4[j]); char_array_4[j] = (unsigned char) chars.find( char_array_4[j] );
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);

View File

@@ -382,15 +382,35 @@ private:
return codepoint; return codepoint;
} }
// cereal Temporary until constexpr support is added in RTM
#ifdef _MSC_VER
template <class Ch>
bool characterOk( Ch c )
{
return c < 256;
}
template <>
bool characterOk<char>( Ch )
{
return true;
}
#else
template<class Ch> template<class Ch>
typename std::enable_if<std::numeric_limits<Ch>::max() < 265, bool>::type typename std::enable_if < std::numeric_limits<Ch>::max() < 265, bool>::type
characterOk(Ch c) characterOk( Ch c )
{ return true; } {
return true;
}
template<class Ch> template<class Ch>
typename std::enable_if<std::numeric_limits<Ch>::max() >= 265, bool>::type typename std::enable_if<std::numeric_limits<Ch>::max() >= 265, bool>::type
characterOk(Ch c) characterOk( Ch c )
{ return c < 256; } {
return c < 256;
}
#endif
// Parse string, handling the prefix and suffix double quotes and escaping. // Parse string, handling the prefix and suffix double quotes and escaping.
template<unsigned parseFlags, typename Stream, typename Handler> template<unsigned parseFlags, typename Stream, typename Handler>

View File

@@ -37,8 +37,14 @@ public:
Writer(Stream& stream, int precision = 20, Allocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) : Writer(Stream& stream, int precision = 20, Allocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) :
stream_(stream), level_stack_(allocator, levelDepth * sizeof(Level)) stream_(stream), level_stack_(allocator, levelDepth * sizeof(Level))
{ {
(void) snprintf(double_format, sizeof(double_format), "%%0.%dg", precision); #if _MSC_VER
(void) snprintf(long_double_format, sizeof(long_double_format), "%%0.%dLg", precision); (void) sprintf_s(double_format, sizeof(double_format), "%%0.%dg", precision);
(void) sprintf_s( long_double_format, sizeof( long_double_format ), "%%0.%dLg", precision );
#else
(void) snprintf(double_format, sizeof(double_format), "%%0.%dg", precision);
(void) snprintf( long_double_format, sizeof( long_double_format ), "%%0.%dLg", precision );
#endif
} }
protected: protected:
@@ -170,15 +176,33 @@ protected:
} while (p != buffer); } while (p != buffer);
} }
// cereal Temporary until constexpr support is added in RTM
#ifdef _MSC_VER
template <class Ch>
bool characterOk( Ch c )
{
return c < 256;
}
template <>
bool characterOk<char>( Ch )
{
return true;
}
#else
template<class Ch> template<class Ch>
typename std::enable_if<std::numeric_limits<Ch>::max() < 265, bool>::type typename std::enable_if < std::numeric_limits<Ch>::max() < 265, bool>::type
characterOk(Ch c) characterOk( Ch c )
{ return true; } {
return true;
}
template<class Ch> template<class Ch>
typename std::enable_if<std::numeric_limits<Ch>::max() >= 265, bool>::type typename std::enable_if<std::numeric_limits<Ch>::max() >= 265, bool>::type
characterOk(Ch c) characterOk(Ch c)
{ return c < 256; } { return c < 256; }
#endif
//! \todo Optimization with custom double-to-string converter. //! \todo Optimization with custom double-to-string converter.
void WriteDouble(double d) { void WriteDouble(double d) {

View File

@@ -38,26 +38,26 @@ namespace cereal
//! Saving for std::array primitive types //! Saving for std::array primitive types
//! using binary serialization, if supported //! using binary serialization, if supported
template <class Archive, class T, size_t N> inline template <class Archive, class T, size_t N> inline
typename std::enable_if<traits::is_output_serializable<BinaryData<T>, Archive>() typename std::enable_if<traits::is_output_serializable<BinaryData<T>, Archive>::value
&& std::is_arithmetic<T>::value, void>::type && std::is_arithmetic<T>::value, void>::type
save( Archive & ar, std::array<T, N> const & array ) save( Archive & ar, std::array<T, N> const & array )
{ {
ar( binary_data( array.data(), N * sizeof(T) ) ); ar( binary_data( array.data(), sizeof(array) ) );
} }
//! Loading for std::array primitive types //! Loading for std::array primitive types
//! using binary serialization, if supported //! using binary serialization, if supported
template <class Archive, class T, size_t N> inline template <class Archive, class T, size_t N> inline
typename std::enable_if<traits::is_input_serializable<BinaryData<T>, Archive>() typename std::enable_if<traits::is_input_serializable<BinaryData<T>, Archive>::value
&& std::is_arithmetic<T>::value, void>::type && std::is_arithmetic<T>::value, void>::type
load( Archive & ar, std::array<T, N> & array ) load( Archive & ar, std::array<T, N> & array )
{ {
ar( binary_data( array.data(), N * sizeof(T) ) ); ar( binary_data( array.data(), sizeof(array) ) );
} }
//! Saving for std::array all other types //! Saving for std::array all other types
template <class Archive, class T, size_t N> inline template <class Archive, class T, size_t N> inline
typename std::enable_if<!traits::is_output_serializable<BinaryData<T>, Archive>() typename std::enable_if<!traits::is_output_serializable<BinaryData<T>, Archive>::value
|| !std::is_arithmetic<T>::value, void>::type || !std::is_arithmetic<T>::value, void>::type
save( Archive & ar, std::array<T, N> const & array ) save( Archive & ar, std::array<T, N> const & array )
{ {
@@ -67,7 +67,7 @@ namespace cereal
//! Loading for std::array all other types //! Loading for std::array all other types
template <class Archive, class T, size_t N> inline template <class Archive, class T, size_t N> inline
typename std::enable_if<!traits::is_input_serializable<BinaryData<T>, Archive>() typename std::enable_if<!traits::is_input_serializable<BinaryData<T>, Archive>::value
|| !std::is_arithmetic<T>::value, void>::type || !std::is_arithmetic<T>::value, void>::type
load( Archive & ar, std::array<T, N> & array ) load( Archive & ar, std::array<T, N> & array )
{ {

View File

@@ -57,7 +57,7 @@ namespace cereal
ar( _CEREAL_NVP("type", bitset_detail::type::ulong) ); ar( _CEREAL_NVP("type", bitset_detail::type::ulong) );
ar( _CEREAL_NVP("data", b) ); ar( _CEREAL_NVP("data", b) );
} }
catch( std::overflow_error const & e ) catch( std::overflow_error const & )
{ {
try try
{ {
@@ -65,7 +65,7 @@ namespace cereal
ar( _CEREAL_NVP("type", bitset_detail::type::ullong) ); ar( _CEREAL_NVP("type", bitset_detail::type::ullong) );
ar( _CEREAL_NVP("data", b) ); ar( _CEREAL_NVP("data", b) );
} }
catch( std::overflow_error const & e ) catch( std::overflow_error const & )
{ {
ar( _CEREAL_NVP("type", bitset_detail::type::string) ); ar( _CEREAL_NVP("type", bitset_detail::type::string) );
ar( _CEREAL_NVP("data", bits.to_string()) ); ar( _CEREAL_NVP("data", bits.to_string()) );

View File

@@ -52,15 +52,15 @@ namespace cereal
namespace common_detail namespace common_detail
{ {
//! Serialization for arrays if BinaryData is supported //! Serialization for arrays if BinaryData is supported and we are arithmetic
/*! @internal */ /*! @internal */
template <class Archive, class T> inline template <class Archive, class T> inline
void serializeArray( Archive & ar, T & array, std::true_type /* binary_supported */ ) void serializeArray( Archive & ar, T & array, std::true_type /* binary_supported */ )
{ {
ar( binary_data( array, traits::sizeof_array<T>() * sizeof(typename std::remove_all_extents<T>::type) ) ); ar( binary_data( array, sizeof(array) ) );
} }
//! Serialization for arrays if BinaryData is not supported //! Serialization for arrays if BinaryData is not supported or we are not arithmetic
/*! @internal */ /*! @internal */
template <class Archive, class T> inline template <class Archive, class T> inline
void serializeArray( Archive & ar, T & array, std::false_type /* binary_supported */ ) void serializeArray( Archive & ar, T & array, std::false_type /* binary_supported */ )
@@ -76,7 +76,8 @@ namespace cereal
serialize(Archive & ar, T & array) serialize(Archive & ar, T & array)
{ {
common_detail::serializeArray( ar, array, common_detail::serializeArray( ar, array,
std::integral_constant<bool, traits::is_output_serializable<BinaryData<T>, Archive>()>() ); std::integral_constant<bool, traits::is_output_serializable<BinaryData<T>, Archive>::value &&
std::is_arithmetic<typename std::remove_all_extents<T>::type>::value>() );
} }
} // namespace cereal } // namespace cereal

View File

@@ -52,7 +52,7 @@ namespace cereal
size_type size; size_type size;
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
deque.resize( size ); deque.resize( static_cast<size_t>( size ) );
for( auto & i : deque ) for( auto & i : deque )
ar( i ); ar( i );

View File

@@ -58,7 +58,7 @@ namespace cereal
size_type size; size_type size;
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
forward_list.resize( size ); forward_list.resize( static_cast<size_t>( size ) );
for( auto & i : forward_list ) for( auto & i : forward_list )
ar( i ); ar( i );

View File

@@ -52,7 +52,7 @@ namespace cereal
size_type size; size_type size;
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
list.resize( size ); list.resize( static_cast<size_t>( size ) );
for( auto & i : list ) for( auto & i : list )
ar( i ); ar( i );

View File

@@ -129,7 +129,7 @@ namespace cereal
//! Loading std::shared_ptr, case when user load and allocate (wrapper implementation) //! Loading std::shared_ptr, case when user load and allocate (wrapper implementation)
/*! @internal */ /*! @internal */
template <class Archive, class T> inline template <class Archive, class T> inline
typename std::enable_if<traits::has_load_and_allocate<T, Archive>(), void>::type typename std::enable_if<traits::has_load_and_allocate<T, Archive>::value, void>::type
load( Archive & ar, memory_detail::PtrWrapper<std::shared_ptr<T> &> & wrapper ) load( Archive & ar, memory_detail::PtrWrapper<std::shared_ptr<T> &> & wrapper )
{ {
auto & ptr = wrapper.ptr; auto & ptr = wrapper.ptr;
@@ -152,7 +152,7 @@ namespace cereal
//! Loading std::shared_ptr, case when no user load and allocate (wrapper implementation) //! Loading std::shared_ptr, case when no user load and allocate (wrapper implementation)
/*! @internal */ /*! @internal */
template <class Archive, class T> inline template <class Archive, class T> inline
typename std::enable_if<!traits::has_load_and_allocate<T, Archive>(), void>::type typename std::enable_if<!traits::has_load_and_allocate<T, Archive>::value, void>::type
load( Archive & ar, memory_detail::PtrWrapper<std::shared_ptr<T> &> & wrapper ) load( Archive & ar, memory_detail::PtrWrapper<std::shared_ptr<T> &> & wrapper )
{ {
auto & ptr = wrapper.ptr; auto & ptr = wrapper.ptr;
@@ -196,7 +196,7 @@ namespace cereal
//! Loading std::unique_ptr, case when user provides load_and_allocate (wrapper implementation) //! Loading std::unique_ptr, case when user provides load_and_allocate (wrapper implementation)
/*! @internal */ /*! @internal */
template <class Archive, class T, class D> inline template <class Archive, class T, class D> inline
typename std::enable_if<traits::has_load_and_allocate<T, Archive>(), void>::type typename std::enable_if<traits::has_load_and_allocate<T, Archive>::value, void>::type
load( Archive & ar, memory_detail::PtrWrapper<std::unique_ptr<T, D> &> & wrapper ) load( Archive & ar, memory_detail::PtrWrapper<std::unique_ptr<T, D> &> & wrapper )
{ {
uint8_t isValid; uint8_t isValid;
@@ -213,7 +213,7 @@ namespace cereal
//! Loading std::unique_ptr, case when no load_and_allocate (wrapper implementation) //! Loading std::unique_ptr, case when no load_and_allocate (wrapper implementation)
/*! @internal */ /*! @internal */
template <class Archive, class T, class D> inline template <class Archive, class T, class D> inline
typename std::enable_if<!traits::has_load_and_allocate<T, Archive>(), void>::type typename std::enable_if<!traits::has_load_and_allocate<T, Archive>::value, void>::type
load( Archive & ar, memory_detail::PtrWrapper<std::unique_ptr<T, D> &> & wrapper ) load( Archive & ar, memory_detail::PtrWrapper<std::unique_ptr<T, D> &> & wrapper )
{ {
uint8_t isValid; uint8_t isValid;

View File

@@ -38,6 +38,12 @@
#include <cereal/details/traits.hpp> #include <cereal/details/traits.hpp>
#include <cereal/details/polymorphic_impl.hpp> #include <cereal/details/polymorphic_impl.hpp>
#ifdef _MSC_VER
#define CONSTEXPR
#else
#define CONSTEXPR constexpr
#endif
//! Registers a polymorphic type with cereal //! Registers a polymorphic type with cereal
/*! Polymorphic types must be registered before pointers /*! Polymorphic types must be registered before pointers
to them can be serialized. This also assumes that to them can be serialized. This also assumes that
@@ -59,7 +65,7 @@
template <> \ template <> \
struct binding_name<T> \ struct binding_name<T> \
{ \ { \
static constexpr char const * name() { return #T; }; \ static CONSTEXPR char const * name() { return #T; }; \
}; \ }; \
} } /* end namespaces */ \ } } /* end namespaces */ \
CEREAL_BIND_TO_ARCHIVES(T); CEREAL_BIND_TO_ARCHIVES(T);
@@ -75,7 +81,7 @@
namespace detail { \ namespace detail { \
template <> \ template <> \
struct binding_name<T> \ struct binding_name<T> \
{ static constexpr char const * name() { return Name; }; }; \ { static CONSTEXPR char const * name() { return Name; }; }; \
} } /* end namespaces */ \ } } /* end namespaces */ \
CEREAL_BIND_TO_ARCHIVES(T); CEREAL_BIND_TO_ARCHIVES(T);
@@ -117,9 +123,14 @@ namespace cereal
//! Serialize a shared_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee //! Serialize a shared_ptr if the 2nd msb in the nameid is set, and if we can actually construct the pointee
/*! This check lets us try and skip doing polymorphic machinery if we can get away with /*! This check lets us try and skip doing polymorphic machinery if we can get away with
using the derived class serialize function using the derived class serialize function
Note that on MSVC 2013 preview, is_default_constructible<T> returns true for abstract classes with
default constructors, but on clang/gcc this will return false. So we also need to check for that here.
@internal */ @internal */
template<class Archive, class T> inline template<class Archive, class T> inline
typename std::enable_if<std::is_default_constructible<T>::value || traits::has_load_and_allocate<T, Archive>(), bool>::type typename std::enable_if<(std::is_default_constructible<T>::value
|| traits::has_load_and_allocate<T, Archive>::value)
&& !std::is_abstract<T>::value, bool>::type
serialize_wrapper(Archive & ar, std::shared_ptr<T> & ptr, std::uint32_t const nameid) serialize_wrapper(Archive & ar, std::shared_ptr<T> & ptr, std::uint32_t const nameid)
{ {
if(nameid & detail::msb2_32bit) if(nameid & detail::msb2_32bit)
@@ -135,7 +146,9 @@ namespace cereal
using the derived class serialize function using the derived class serialize function
@internal */ @internal */
template<class Archive, class T, class D> inline template<class Archive, class T, class D> inline
typename std::enable_if<std::is_default_constructible<T>::value || traits::has_load_and_allocate<T, Archive>(), bool>::type typename std::enable_if<(std::is_default_constructible<T>::value
|| traits::has_load_and_allocate<T, Archive>::value)
&& !std::is_abstract<T>::value, bool>::type
serialize_wrapper(Archive & ar, std::unique_ptr<T, D> & ptr, std::uint32_t const nameid) serialize_wrapper(Archive & ar, std::unique_ptr<T, D> & ptr, std::uint32_t const nameid)
{ {
if(nameid & detail::msb2_32bit) if(nameid & detail::msb2_32bit)
@@ -153,7 +166,9 @@ namespace cereal
this was a polymorphic type serialized by its proper pointer type this was a polymorphic type serialized by its proper pointer type
@internal */ @internal */
template<class Archive, class T> inline template<class Archive, class T> inline
typename std::enable_if<!std::is_default_constructible<T>::value && !traits::has_load_and_allocate<T, Archive>(), bool>::type typename std::enable_if<(!std::is_default_constructible<T>::value
&& !traits::has_load_and_allocate<T, Archive>::value)
|| std::is_abstract<T>::value, bool>::type
serialize_wrapper(Archive &, std::shared_ptr<T> &, std::uint32_t const nameid) serialize_wrapper(Archive &, std::shared_ptr<T> &, std::uint32_t const nameid)
{ {
if(nameid & detail::msb2_32bit) if(nameid & detail::msb2_32bit)
@@ -168,7 +183,9 @@ namespace cereal
this was a polymorphic type serialized by its proper pointer type this was a polymorphic type serialized by its proper pointer type
@internal */ @internal */
template<class Archive, class T, class D> inline template<class Archive, class T, class D> inline
typename std::enable_if<!std::is_default_constructible<T>::value && !traits::has_load_and_allocate<T, Archive>(), bool>::type typename std::enable_if<(!std::is_default_constructible<T>::value
&& !traits::has_load_and_allocate<T, Archive>::value)
|| std::is_abstract<T>::value, bool>::type
serialize_wrapper(Archive &, std::unique_ptr<T, D> &, std::uint32_t const nameid) serialize_wrapper(Archive &, std::unique_ptr<T, D> &, std::uint32_t const nameid)
{ {
if(nameid & detail::msb2_32bit) if(nameid & detail::msb2_32bit)

View File

@@ -37,7 +37,7 @@ namespace cereal
{ {
//! Serialization for basic_string types, if binary data is supported //! Serialization for basic_string types, if binary data is supported
template<class Archive, class CharT, class Traits, class Alloc> inline template<class Archive, class CharT, class Traits, class Alloc> inline
typename std::enable_if<traits::is_output_serializable<BinaryData<CharT>, Archive>(), void>::type typename std::enable_if<traits::is_output_serializable<BinaryData<CharT>, Archive>::value, void>::type
save(Archive & ar, std::basic_string<CharT, Traits, Alloc> const & str) save(Archive & ar, std::basic_string<CharT, Traits, Alloc> const & str)
{ {
// Save number of chars + the data // Save number of chars + the data
@@ -47,13 +47,13 @@ namespace cereal
//! Serialization for basic_string types, if binary data is supported //! Serialization for basic_string types, if binary data is supported
template<class Archive, class CharT, class Traits, class Alloc> inline template<class Archive, class CharT, class Traits, class Alloc> inline
typename std::enable_if<traits::is_input_serializable<BinaryData<CharT>, Archive>(), void>::type typename std::enable_if<traits::is_input_serializable<BinaryData<CharT>, Archive>::value, void>::type
load(Archive & ar, std::basic_string<CharT, Traits, Alloc> & str) load(Archive & ar, std::basic_string<CharT, Traits, Alloc> & str)
{ {
size_type size; size_type size;
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
str.resize(size); str.resize(static_cast<std::size_t>(size));
ar( binary_data( &(*str.begin()), size * sizeof(CharT) ) ); ar( binary_data( &(*str.begin()), static_cast<std::size_t>(size) * sizeof(CharT) ) );
} }
} // namespace cereal } // namespace cereal

View File

@@ -55,7 +55,7 @@ namespace cereal
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
map.clear(); map.clear();
map.reserve( size ); map.reserve( static_cast<std::size_t>( size ) );
for( size_type i = 0; i < size; ++i ) for( size_type i = 0; i < size; ++i )
{ {

View File

@@ -55,7 +55,7 @@ namespace cereal
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
set.clear(); set.clear();
set.reserve( size ); set.reserve( static_cast<std::size_t>( size ) );
for( size_type i = 0; i < size; ++i ) for( size_type i = 0; i < size; ++i )
{ {

View File

@@ -37,7 +37,7 @@ namespace cereal
{ {
//! Serialization for std::vectors of arithmetic (but not bool) using binary serialization, if supported //! Serialization for std::vectors of arithmetic (but not bool) using binary serialization, if supported
template <class Archive, class T, class A> inline template <class Archive, class T, class A> inline
typename std::enable_if<traits::is_output_serializable<BinaryData<T>, Archive>() typename std::enable_if<traits::is_output_serializable<BinaryData<T>, Archive>::value
&& std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, void>::type && std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, void>::type
save( Archive & ar, std::vector<T, A> const & vector ) save( Archive & ar, std::vector<T, A> const & vector )
{ {
@@ -47,20 +47,20 @@ namespace cereal
//! Serialization for std::vectors of arithmetic (but not bool) using binary serialization, if supported //! Serialization for std::vectors of arithmetic (but not bool) using binary serialization, if supported
template <class Archive, class T, class A> inline template <class Archive, class T, class A> inline
typename std::enable_if<traits::is_input_serializable<BinaryData<T>, Archive>() typename std::enable_if<traits::is_input_serializable<BinaryData<T>, Archive>::value
&& std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, void>::type && std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, void>::type
load( Archive & ar, std::vector<T, A> & vector ) load( Archive & ar, std::vector<T, A> & vector )
{ {
size_type vectorSize; size_type vectorSize;
ar( make_size_tag( vectorSize ) ); ar( make_size_tag( vectorSize ) );
vector.resize( vectorSize ); vector.resize( static_cast<std::size_t>( vectorSize ) );
ar( binary_data( vector.data(), vectorSize * sizeof(T) ) ); ar( binary_data( vector.data(), static_cast<std::size_t>( vectorSize ) * sizeof(T) ) );
} }
//! Serialization for non-arithmetic (and bool) vector types //! Serialization for non-arithmetic (and bool) vector types
template <class Archive, class T, class A> inline template <class Archive, class T, class A> inline
typename std::enable_if<!traits::is_output_serializable<BinaryData<T>, Archive>() typename std::enable_if<!traits::is_output_serializable<BinaryData<T>, Archive>::value
|| !std::is_arithmetic<T>::value || !std::is_arithmetic<T>::value
|| std::is_same<T, bool>::value, void>::type || std::is_same<T, bool>::value, void>::type
save( Archive & ar, std::vector<T, A> const & vector ) save( Archive & ar, std::vector<T, A> const & vector )
@@ -72,7 +72,7 @@ namespace cereal
//! Serialization for non-arithmetic (and bool) vector types //! Serialization for non-arithmetic (and bool) vector types
template <class Archive, class T, class A> inline template <class Archive, class T, class A> inline
typename std::enable_if<!traits::is_input_serializable<BinaryData<T>, Archive>() typename std::enable_if<!traits::is_input_serializable<BinaryData<T>, Archive>::value
|| !std::is_arithmetic<T>::value || !std::is_arithmetic<T>::value
|| std::is_same<T, bool>::value, void>::type || std::is_same<T, bool>::value, void>::type
load( Archive & ar, std::vector<T, A> & vector ) load( Archive & ar, std::vector<T, A> & vector )
@@ -80,7 +80,7 @@ namespace cereal
size_type size; size_type size;
ar( make_size_tag( size ) ); ar( make_size_tag( size ) );
vector.resize( size ); vector.resize( static_cast<std::size_t>( size ) );
for( auto it = vector.begin(), end = vector.end(); it != end; ++it ) for( auto it = vector.begin(), end = vector.end(); it != end; ++it )
ar( *it ); ar( *it );
} }

View File

@@ -24,6 +24,11 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4244 4267)
#endif
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <chrono> #include <chrono>
@@ -166,9 +171,6 @@ void test( std::string const & name,
auto loadResult = loadData<DataT>( os, {SerializationT::boost::template load<DataT>} ); auto loadResult = loadData<DataT>( os, {SerializationT::boost::template load<DataT>} );
totalBoostLoad += loadResult.second; totalBoostLoad += loadResult.second;
if( validateData )
; // TODO
} }
// Cereal // Cereal
@@ -181,9 +183,6 @@ void test( std::string const & name,
auto loadResult = loadData<DataT>( os, {SerializationT::cereal::template load<DataT>} ); auto loadResult = loadData<DataT>( os, {SerializationT::cereal::template load<DataT>} );
totalCerealLoad += loadResult.second; totalCerealLoad += loadResult.second;
if( validateData )
; // TODO
} }
} }
@@ -222,10 +221,15 @@ random_value(std::mt19937 & gen)
{ return std::uniform_real_distribution<T>(-10000.0, 10000.0)(gen); } { return std::uniform_real_distribution<T>(-10000.0, 10000.0)(gen); }
template<class T> template<class T>
typename std::enable_if<std::is_integral<T>::value, T>::type typename std::enable_if<std::is_integral<T>::value && sizeof(T) != sizeof(char), T>::type
random_value(std::mt19937 & gen) random_value(std::mt19937 & gen)
{ return std::uniform_int_distribution<T>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max())(gen); } { return std::uniform_int_distribution<T>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max())(gen); }
template<class T>
typename std::enable_if<std::is_integral<T>::value && sizeof(T) == sizeof(char), T>::type
random_value(std::mt19937 & gen)
{ return static_cast<T>( std::uniform_int_distribution<int64_t>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max())(gen) ); }
template<class T> template<class T>
typename std::enable_if<std::is_same<T, std::string>::value, std::string>::type typename std::enable_if<std::is_same<T, std::string>::value, std::string>::type
random_value(std::mt19937 & gen) random_value(std::mt19937 & gen)
@@ -241,7 +245,8 @@ std::basic_string<C> random_basic_string(std::mt19937 & gen, size_t maxSize = 30
{ {
std::basic_string<C> s(std::uniform_int_distribution<int>(3, maxSize)(gen), ' '); std::basic_string<C> s(std::uniform_int_distribution<int>(3, maxSize)(gen), ' ');
for(C & c : s) for(C & c : s)
c = std::uniform_int_distribution<C>(' ', '~')(gen); c = static_cast<C>( std::uniform_int_distribution<int>( '~', '~' )(gen) );
return s;
return s; return s;
} }
@@ -408,7 +413,7 @@ int main()
std::map<std::string, PoDStruct> m; std::map<std::string, PoDStruct> m;
for(size_t i=0; i<s; ++i) for(size_t i=0; i<s; ++i)
m[std::to_string(i)] = {}; m[std::to_string( i )] = PoDStruct();
test<binary>(name.str(), m); test<binary>(name.str(), m);
}; };
@@ -417,3 +422,7 @@ int main()
return 0; return 0;
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View File

@@ -42,7 +42,7 @@
#include <cereal/types/bitset.hpp> #include <cereal/types/bitset.hpp>
#include <cereal/types/polymorphic.hpp> #include <cereal/types/polymorphic.hpp>
#include <cxxabi.h> //#include <cxxabi.h>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
@@ -70,7 +70,7 @@ class Derived : public Base
{ {
public: public:
using Base::x; using Base::x;
Derived() = default; Derived() : Base(), y() {}
Derived( int d, int b ) Derived( int d, int b )
{ {
y = d; y = d;
@@ -244,7 +244,9 @@ struct NonEmptyStruct
struct NoDefaultCtor struct NoDefaultCtor
{ {
NoDefaultCtor() = delete; private:
NoDefaultCtor() {};
public:
NoDefaultCtor(int x) : y(x) NoDefaultCtor(int x) : y(x)
{ } { }

View File

@@ -40,13 +40,13 @@
#include <cereal/external/rapidjson/filestream.h> #include <cereal/external/rapidjson/filestream.h>
#include <cxxabi.h>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
#include <complex> #include <complex>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <string>
// ################################### // ###################################
struct Test1 struct Test1
@@ -174,11 +174,18 @@ struct Everything
struct SubFixture struct SubFixture
{ {
int a = 3; SubFixture() : a( 3 ),
uint64_t b = 9999; b( 9999 ),
float c = 100.1; c( 100.1f ),
double d = 2000.9; d( 2000.9 ),
std::string s = "hello, world!"; s( "hello, world!" )
{}
int a;
uint64_t b;
float c;
double d;
std::string s;
template<class Archive> template<class Archive>
void serialize(Archive & ar) void serialize(Archive & ar)
@@ -202,7 +209,15 @@ struct SubFixture
struct Fixture struct Fixture
{ {
SubFixture f1, f2, f3; SubFixture f1, f2, f3;
int array[4] = {1, 2, 3, 4}; int array[4];
Fixture()
{
array[0] = 1;
array[1] = 2;
array[2] = 3;
array[3] = 4;
}
template<class Archive> template<class Archive>
void save(Archive & ar) const void save(Archive & ar) const
@@ -232,9 +247,10 @@ struct Fixture
struct AAA struct AAA
{ {
int one = 1, two = 2; AAA() : one( 1 ), two( 2 ), three( { {1, 2, 3}, { 4, 5, 6 }, {} } ) {}
int one, two;
std::vector<std::vector<int>> three = {{1,2,3}, {4,5,6}, {}}; std::vector<std::vector<int>> three;
template<class Archive> template<class Archive>
void serialize(Archive & ar) void serialize(Archive & ar)
@@ -247,16 +263,18 @@ struct AAA
class Stuff class Stuff
{ {
public: public:
Stuff() = default; Stuff() {}
void fillData() void fillData()
{ {
data = { {"imaginary", {{0, -1.0f}, std::vector<std::complex<float>> t1{ {0, -1.0f},
{0, -2.9932f}, { 0, -2.9932f },
{0, -3.5f}}}, { 0, -3.5f } };
{"real", {{1.0f, 0}, std::vector<std::complex<float>> t2{ {1.0f, 0},
{2.2f, 0}, { 2.2f, 0 },
{3.3f, 0}}} }; { 3.3f, 0 } };
data["imaginary"] = t1;
data["real"] = t2;
} }
private: private:
@@ -300,6 +318,10 @@ int main()
std::vector<int> vec = {1, 2, 3, 4, 5}; std::vector<int> vec = {1, 2, 3, 4, 5};
archive( CEREAL_NVP(vec), archive( CEREAL_NVP(vec),
arr ); arr );
auto f = std::make_shared<Fixture>();
auto f2 = f;
archive( f );
archive( f2 );
} }

View File

@@ -110,7 +110,7 @@ struct OurBase
struct OurType : public OurBase struct OurType : public OurBase
{ {
OurType() = default; OurType() : OurBase(), x() {}
OurType(int x_) : x(x_) {} OurType(int x_) : x(x_) {}
void foo() {} void foo() {}
@@ -201,11 +201,11 @@ int main()
//oarchive(ptr2); //oarchive(ptr2);
//oarchive(ptr3); //oarchive(ptr3);
//oarchive(ptr4); //oarchive(ptr4);
oarchive(ptr5); //oarchive(ptr5);
std::shared_ptr<AAA> a = std::make_shared<BBB>(); //std::shared_ptr<AAA> a = std::make_shared<BBB>();
oarchive(a); //oarchive(a);
} }
{ {
@@ -223,6 +223,6 @@ int main()
//iarchive(ptr2); //iarchive(ptr2);
//iarchive(ptr3); //iarchive(ptr3);
//iarchive(ptr4); //iarchive(ptr4);
iarchive(ptr5); //iarchive(ptr5);
} }
} }

220
sandbox_vs.cpp Normal file
View File

@@ -0,0 +1,220 @@
#include <cereal/access.hpp>
#include <cereal/details/traits.hpp>
#include <cereal/details/helpers.hpp>
#include <cereal/types/base_class.hpp>
#include <cereal/cereal.hpp>
#include <cereal/types/array.hpp>
#include <cereal/types/bitset.hpp>
#include <cereal/types/boost_variant.hpp>
#include <cereal/types/chrono.hpp>
#include <cereal/types/common.hpp>
#include <cereal/types/complex.hpp>
#include <cereal/types/deque.hpp>
#include <cereal/types/forward_list.hpp>
#include <cereal/types/list.hpp>
#include <cereal/types/map.hpp>
#include <cereal/types/memory.hpp>
#include <cereal/details/util.hpp>
#include <cereal/details/polymorphic_impl.hpp>
#include <cereal/types/polymorphic.hpp>
#include <cereal/types/queue.hpp>
#include <cereal/types/set.hpp>
#include <cereal/types/stack.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/tuple.hpp>
#include <cereal/types/unordered_map.hpp>
#include <cereal/types/unordered_set.hpp>
#include <cereal/types/utility.hpp>
#include <cereal/types/vector.hpp>
#include <cereal/archives/binary.hpp>
//#include <cereal/archives/portable_binary.hpp>
#include <cereal/archives/xml.hpp>
#include <cereal/archives/json.hpp>
#include <iostream>
#include <type_traits>
#include <functional>
struct Archive {};
struct Test
{
template <class Archive>
void serialzize( Archive & ar )
{
std::cout << "hey there" << std::endl;
}
template <class Archive>
void save( Archive & ar ) const
{
std::cout << "saved by the bell" << std::endl;
}
template <class Archive>
void load( Archive & ar )
{
std::cout << "locked and loaded" << std::endl;
}
template <class Archive>
static Test * load_and_allocate( Archive & ar )
{
return new Test();
}
};
template <class Archive>
void serialize( Archive & ar, Test & t )
{ }
template <class Archive>
void load( Archive & ar, Test & t )
{ }
template <class Archive>
void save( Archive & ar, Test const & t )
{ }
namespace cereal
{
template <>
struct LoadAndAllocate<Test>
{
template <class Archive>
static Test * load_and_allocate( Archive & ar )
{
return new Test();
}
};
}
struct A
{
virtual void foo() = 0;
};
struct B : A
{
void foo() {}
template <class Archive>
void serialize( Archive & ar )
{
std::cout << "i'm in your b" << std::endl;
}
};
struct C
{
char a;
};
//CEREAL_REGISTER_TYPE(B);
template <class T, class A>
static auto test(int) -> decltype( cereal::access::member_serialize( std::declval<A&>(), std::declval<T&>() ), std::true_type())
{ return {}; }
template <class T, class A>
static auto test(...) -> std::false_type
{ return {}; }
int main()
{
typedef Test T;
std::cout << std::boolalpha;
// Test Load and Allocate internal/external
std::cout << "\tload_and_allocate" << std::endl;
std::cout << cereal::traits::has_member_load_and_allocate<T, Archive>::value << std::endl;
std::cout << cereal::traits::has_non_member_load_and_allocate<T, Archive>::value << std::endl;
// serialize
std::cout << "\tserialize" << std::endl;
std::cout << cereal::traits::has_member_serialize<T, Archive>::value << std::endl;
std::cout << cereal::traits::has_non_member_serialize<T, Archive>::value << std::endl;
std::cout << test<T, Archive>(0) << std::endl;
// load
std::cout << "\tload" << std::endl;
std::cout << cereal::traits::has_member_load<T, Archive>::value << std::endl;
std::cout << cereal::traits::has_non_member_load<T, Archive>::value << std::endl;
// save
std::cout << "\tsave" << std::endl;
std::cout << cereal::traits::has_member_save<T, Archive>::value << std::endl;
std::cout << cereal::traits::has_non_member_save<T, Archive>::value << std::endl;
// splittable
std::cout << "\t splittable" << std::endl;
std::cout << cereal::traits::has_member_split<T, Archive, Archive>::value << std::endl;
std::cout << cereal::traits::has_non_member_split<T, Archive, Archive>::value << std::endl;
// serialiable
std::cout << "\toutput serializable" << std::endl;
std::cout << cereal::traits::is_output_serializable<T, Archive>::value << std::endl;
std::cout << cereal::traits::is_input_serializable<T, Archive>::value << std::endl;
// specialized
std::cout << "\tspecialized" << std::endl;
std::cout << cereal::traits::detail::is_specialized_member_serialize<T, Archive>::value << std::endl;
std::cout << cereal::traits::detail::is_specialized_member_load_save<T, Archive>::value << std::endl;
std::cout << cereal::traits::detail::is_specialized_non_member_serialize<T, Archive>::value << std::endl;
std::cout << cereal::traits::detail::is_specialized_non_member_load_save<T, Archive>::value << std::endl;
std::cout << cereal::traits::detail::is_specialized_error<T, Archive>::value << std::endl;
std::cout << cereal::traits::is_specialized<T, Archive>::value << std::endl;
// array size
std::cout << typeid(A).name() << std::endl;
std::cout << typeid(cereal::traits::has_load_and_allocate<int, bool>).name() << std::endl;
//Archive a;
//T t;
//cereal::access::member_save( a, t );
//cereal::access::member_load( a, t );
//cereal::access::member_serialize( a, t );
//std::stringstream ss;
//{
// cereal::JSONOutputArchive ar( ss );
// ar( 5 );
// ar( cereal::make_nvp("hello", 2.4f ) );
// std::string s = "hey yo";
// ar( CEREAL_NVP( s ) );
// int darp [] = { 1, 2, 3 };
// ar.saveBinaryValue( darp, sizeof(int) * 3, "darp" );
// std::unique_ptr<A> ptr( new B() );
// ar( CEREAL_NVP( ptr ) );
//}
//{
// cereal::JSONInputArchive ar( ss );
// int x;
// ar( x );
// assert( x == 5 );
// float f;
// ar( f );
// assert( f == 2.4f );
// std::string s;
// ar( s );
// assert( s == "hey yo" );
// int darp[3];
// ar.loadBinaryValue( darp, sizeof(int) * 3 );
// assert( darp[0] == 1 );
// assert( darp[1] == 2 );
// assert( darp[2] == 3 );
// std::unique_ptr<A> ptr;
// std::cout << "----------" << std::endl;
// std::cout << std::is_default_constructible<A>::value << std::endl;
// std::cout << cereal::traits::has_load_and_allocate<A, cereal::JSONInputArchive>::value << std::endl;
// ar( ptr );
//}
return 0;
}

View File

@@ -75,6 +75,8 @@ namespace cereal
struct StructBase struct StructBase
{ {
StructBase() {}
StructBase( int xx, int yy ) : x( xx ), y( yy ) {}
int x, y; int x, y;
bool operator==(StructBase const & other) const bool operator==(StructBase const & other) const
{ return x == other.x && y == other.y; } { return x == other.x && y == other.y; }
@@ -171,17 +173,22 @@ random_value(std::mt19937 & gen)
{ return std::uniform_real_distribution<T>(-10000.0, 10000.0)(gen); } { return std::uniform_real_distribution<T>(-10000.0, 10000.0)(gen); }
template<class T> template<class T>
typename std::enable_if<std::is_integral<T>::value, T>::type typename std::enable_if<std::is_integral<T>::value && sizeof(T) != sizeof(char), T>::type
random_value(std::mt19937 & gen) random_value(std::mt19937 & gen)
{ return std::uniform_int_distribution<T>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max())(gen); } { return std::uniform_int_distribution<T>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max())(gen); }
template<class T>
typename std::enable_if<std::is_integral<T>::value && sizeof(T) == sizeof(char), T>::type
random_value(std::mt19937 & gen)
{ return static_cast<T>( std::uniform_int_distribution<int64_t>(std::numeric_limits<T>::lowest(), std::numeric_limits<T>::max())(gen) ); }
template<class T> template<class T>
typename std::enable_if<std::is_same<T, std::string>::value, std::string>::type typename std::enable_if<std::is_same<T, std::string>::value, std::string>::type
random_value(std::mt19937 & gen) random_value(std::mt19937 & gen)
{ {
std::string s(std::uniform_int_distribution<int>(3, 30)(gen), ' '); std::string s(std::uniform_int_distribution<int>(3, 30)(gen), ' ');
for(char & c : s) for(char & c : s)
c = std::uniform_int_distribution<char>(' ', '~')(gen); c = static_cast<char>( std::uniform_int_distribution<int>( '~', '~' )(gen) );
return s; return s;
} }
@@ -190,7 +197,7 @@ std::basic_string<C> random_basic_string(std::mt19937 & gen)
{ {
std::basic_string<C> s(std::uniform_int_distribution<int>(3, 30)(gen), ' '); std::basic_string<C> s(std::uniform_int_distribution<int>(3, 30)(gen), ' ');
for(C & c : s) for(C & c : s)
c = std::uniform_int_distribution<C>(' ', '~')(gen); c = static_cast<C>( std::uniform_int_distribution<int>( '~', '~' )(gen) );
return s; return s;
} }
@@ -199,7 +206,7 @@ std::string random_binary_string(std::mt19937 & gen)
{ {
std::string s(N, ' '); std::string s(N, ' ');
for(auto & c : s ) for(auto & c : s )
c = std::uniform_int_distribution<char>('0', '1')(gen); c = static_cast<char>( std::uniform_int_distribution<int>( '0', '1' )(gen) );
return s; return s;
} }
@@ -241,16 +248,16 @@ void test_pod()
} }
bool i_bool = false; bool i_bool = false;
uint8_t i_uint8 = 0.0; uint8_t i_uint8 = 0;
int8_t i_int8 = 0.0; int8_t i_int8 = 0;
uint16_t i_uint16 = 0.0; uint16_t i_uint16 = 0;
int16_t i_int16 = 0.0; int16_t i_int16 = 0;
uint32_t i_uint32 = 0.0; uint32_t i_uint32 = 0;
int32_t i_int32 = 0.0; int32_t i_int32 = 0;
uint64_t i_uint64 = 0.0; uint64_t i_uint64 = 0;
int64_t i_int64 = 0.0; int64_t i_int64 = 0;
float i_float = 0.0; float i_float = 0;
double i_double = 0.0; double i_double = 0;
std::istringstream is(os.str()); std::istringstream is(os.str());
{ {
@@ -277,7 +284,7 @@ void test_pod()
BOOST_CHECK_EQUAL(i_int32 , o_int32); BOOST_CHECK_EQUAL(i_int32 , o_int32);
BOOST_CHECK_EQUAL(i_uint64 , o_uint64); BOOST_CHECK_EQUAL(i_uint64 , o_uint64);
BOOST_CHECK_EQUAL(i_int64 , o_int64); BOOST_CHECK_EQUAL(i_int64 , o_int64);
BOOST_CHECK_CLOSE(i_float , o_float, 1e-5); BOOST_CHECK_CLOSE(i_float , o_float, (float)1e-5);
BOOST_CHECK_CLOSE(i_double , o_double, 1e-5); BOOST_CHECK_CLOSE(i_double , o_double, 1e-5);
} }
} }
@@ -371,23 +378,23 @@ void test_array()
{ {
std::array<int, 100> o_podarray; std::array<int, 100> o_podarray;
for(auto & elem : o_podarray) for(auto & elem : o_podarray)
elem = random_value<decltype(o_podarray)::value_type>(gen); elem = random_value<int>(gen);
std::array<StructInternalSerialize, 100> o_iserarray; std::array<StructInternalSerialize, 100> o_iserarray;
for(auto & elem : o_iserarray) for(auto & elem : o_iserarray)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::array<StructInternalSplit, 100> o_isplarray; std::array<StructInternalSplit, 100> o_isplarray;
for(auto & elem : o_isplarray) for(auto & elem : o_isplarray)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::array<StructExternalSerialize, 100> o_eserarray; std::array<StructExternalSerialize, 100> o_eserarray;
for(auto & elem : o_eserarray) for(auto & elem : o_eserarray)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::array<StructExternalSplit, 100> o_esplarray; std::array<StructExternalSplit, 100> o_esplarray;
for(auto & elem : o_esplarray) for(auto & elem : o_esplarray)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::ostringstream os; std::ostringstream os;
{ {
@@ -456,23 +463,23 @@ void test_deque()
{ {
std::deque<int> o_poddeque(100); std::deque<int> o_poddeque(100);
for(auto & elem : o_poddeque) for(auto & elem : o_poddeque)
elem = random_value<decltype(o_poddeque)::value_type>(gen); elem = random_value<int>(gen);
std::deque<StructInternalSerialize> o_iserdeque(100); std::deque<StructInternalSerialize> o_iserdeque(100);
for(auto & elem : o_iserdeque) for(auto & elem : o_iserdeque)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::deque<StructInternalSplit> o_ispldeque(100); std::deque<StructInternalSplit> o_ispldeque(100);
for(auto & elem : o_ispldeque) for(auto & elem : o_ispldeque)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::deque<StructExternalSerialize> o_eserdeque(100); std::deque<StructExternalSerialize> o_eserdeque(100);
for(auto & elem : o_eserdeque) for(auto & elem : o_eserdeque)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::deque<StructExternalSplit> o_espldeque(100); std::deque<StructExternalSplit> o_espldeque(100);
for(auto & elem : o_espldeque) for(auto & elem : o_espldeque)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::ostringstream os; std::ostringstream os;
{ {
@@ -547,23 +554,23 @@ void test_forward_list()
{ {
std::forward_list<int> o_podforward_list(100); std::forward_list<int> o_podforward_list(100);
for(auto & elem : o_podforward_list) for(auto & elem : o_podforward_list)
elem = random_value<decltype(o_podforward_list)::value_type>(gen); elem = random_value<int>(gen);
std::forward_list<StructInternalSerialize> o_iserforward_list(100); std::forward_list<StructInternalSerialize> o_iserforward_list(100);
for(auto & elem : o_iserforward_list) for(auto & elem : o_iserforward_list)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::forward_list<StructInternalSplit> o_isplforward_list(100); std::forward_list<StructInternalSplit> o_isplforward_list(100);
for(auto & elem : o_isplforward_list) for(auto & elem : o_isplforward_list)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::forward_list<StructExternalSerialize> o_eserforward_list(100); std::forward_list<StructExternalSerialize> o_eserforward_list(100);
for(auto & elem : o_eserforward_list) for(auto & elem : o_eserforward_list)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::forward_list<StructExternalSplit> o_esplforward_list(100); std::forward_list<StructExternalSplit> o_esplforward_list(100);
for(auto & elem : o_esplforward_list) for(auto & elem : o_esplforward_list)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::ostringstream os; std::ostringstream os;
{ {
@@ -632,23 +639,23 @@ void test_list()
{ {
std::list<int> o_podlist(100); std::list<int> o_podlist(100);
for(auto & elem : o_podlist) for(auto & elem : o_podlist)
elem = random_value<decltype(o_podlist)::value_type>(gen); elem = random_value<int>(gen);
std::list<StructInternalSerialize> o_iserlist(100); std::list<StructInternalSerialize> o_iserlist(100);
for(auto & elem : o_iserlist) for(auto & elem : o_iserlist)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::list<StructInternalSplit> o_ispllist(100); std::list<StructInternalSplit> o_ispllist(100);
for(auto & elem : o_ispllist) for(auto & elem : o_ispllist)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::list<StructExternalSerialize> o_eserlist(100); std::list<StructExternalSerialize> o_eserlist(100);
for(auto & elem : o_eserlist) for(auto & elem : o_eserlist)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::list<StructExternalSplit> o_espllist(100); std::list<StructExternalSplit> o_espllist(100);
for(auto & elem : o_espllist) for(auto & elem : o_espllist)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::ostringstream os; std::ostringstream os;
{ {
@@ -2095,23 +2102,23 @@ void test_vector()
{ {
std::vector<int> o_podvector(100); std::vector<int> o_podvector(100);
for(auto & elem : o_podvector) for(auto & elem : o_podvector)
elem = random_value<decltype(o_podvector)::value_type>(gen); elem = random_value<int>(gen);
std::vector<StructInternalSerialize> o_iservector(100); std::vector<StructInternalSerialize> o_iservector(100);
for(auto & elem : o_iservector) for(auto & elem : o_iservector)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::vector<StructInternalSplit> o_isplvector(100); std::vector<StructInternalSplit> o_isplvector(100);
for(auto & elem : o_isplvector) for(auto & elem : o_isplvector)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructInternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::vector<StructExternalSerialize> o_eservector(100); std::vector<StructExternalSerialize> o_eservector(100);
for(auto & elem : o_eservector) for(auto & elem : o_eservector)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSerialize( random_value<int>(gen), random_value<int>(gen) );
std::vector<StructExternalSplit> o_esplvector(100); std::vector<StructExternalSplit> o_esplvector(100);
for(auto & elem : o_esplvector) for(auto & elem : o_esplvector)
elem = { random_value<int>(gen), random_value<int>(gen) }; elem = StructExternalSplit( random_value<int>(gen), random_value<int>(gen) );
std::ostringstream os; std::ostringstream os;
{ {
@@ -2682,7 +2689,7 @@ BOOST_AUTO_TEST_CASE( json_structs_specialized )
// ###################################################################### // ######################################################################
struct PolyBase struct PolyBase
{ {
PolyBase() = default; PolyBase() {}
PolyBase( int xx, float yy ) : x(xx), y(yy) {} PolyBase( int xx, float yy ) : x(xx), y(yy) {}
int x; int x;
float y; float y;
@@ -2703,7 +2710,7 @@ struct PolyBase
struct PolyDerived : PolyBase struct PolyDerived : PolyBase
{ {
PolyDerived() = default; PolyDerived() {}
PolyDerived( int xx, float yy, bool aa, double bb ) : PolyDerived( int xx, float yy, bool aa, double bb ) :
PolyBase( xx, yy ), a(aa), b(bb) {} PolyBase( xx, yy ), a(aa), b(bb) {}
@@ -2739,7 +2746,7 @@ void test_polymorphic()
std::random_device rd; std::random_device rd;
std::mt19937 gen(rd()); std::mt19937 gen(rd());
auto rngB = [&](){ return random_value<int>( gen ) % 2; }; auto rngB = [&](){ return random_value<int>( gen ) % 2 == 0; };
auto rngI = [&](){ return random_value<int>( gen ); }; auto rngI = [&](){ return random_value<int>( gen ); };
auto rngF = [&](){ return random_value<float>( gen ); }; auto rngF = [&](){ return random_value<float>( gen ); };
auto rngD = [&](){ return random_value<double>( gen ); }; auto rngD = [&](){ return random_value<double>( gen ); };
@@ -2801,10 +2808,17 @@ BOOST_AUTO_TEST_CASE( json_polymorphic )
namespace mynamespace { struct MyCustomClass {}; } namespace mynamespace { struct MyCustomClass {}; }
#ifdef _MSC_VER
BOOST_AUTO_TEST_CASE( util )
{
BOOST_CHECK_EQUAL( cereal::util::demangledName<mynamespace::MyCustomClass>(), "struct mynamespace::MyCustomClass" );
}
#else
BOOST_AUTO_TEST_CASE( util ) BOOST_AUTO_TEST_CASE( util )
{ {
BOOST_CHECK_EQUAL( cereal::util::demangledName<mynamespace::MyCustomClass>(), "mynamespace::MyCustomClass" ); BOOST_CHECK_EQUAL( cereal::util::demangledName<mynamespace::MyCustomClass>(), "mynamespace::MyCustomClass" );
} }
#endif
template <class T> template <class T>
inline void swapBytes( T & t ) inline void swapBytes( T & t )
@@ -2877,16 +2891,16 @@ BOOST_AUTO_TEST_CASE( portable_binary_archive )
swapBytes(o_double); swapBytes(o_double);
bool i_bool = false; bool i_bool = false;
uint8_t i_uint8 = 0.0; uint8_t i_uint8 = 0;
int8_t i_int8 = 0.0; int8_t i_int8 = 0;
uint16_t i_uint16 = 0.0; uint16_t i_uint16 = 0;
int16_t i_int16 = 0.0; int16_t i_int16 = 0;
uint32_t i_uint32 = 0.0; uint32_t i_uint32 = 0;
int32_t i_int32 = 0.0; int32_t i_int32 = 0;
uint64_t i_uint64 = 0.0; uint64_t i_uint64 = 0;
int64_t i_int64 = 0.0; int64_t i_int64 = 0;
float i_float = 0.0; float i_float = 0;
double i_double = 0.0; double i_double = 0;
std::istringstream is(os.str()); std::istringstream is(os.str());
{ {
@@ -2913,7 +2927,7 @@ BOOST_AUTO_TEST_CASE( portable_binary_archive )
BOOST_CHECK_EQUAL(i_int32 , o_int32); BOOST_CHECK_EQUAL(i_int32 , o_int32);
BOOST_CHECK_EQUAL(i_uint64 , o_uint64); BOOST_CHECK_EQUAL(i_uint64 , o_uint64);
BOOST_CHECK_EQUAL(i_int64 , o_int64); BOOST_CHECK_EQUAL(i_int64 , o_int64);
BOOST_CHECK_CLOSE(i_float , o_float, 1e-5); BOOST_CHECK_CLOSE(i_float , o_float, (float)1e-5);
BOOST_CHECK_CLOSE(i_double , o_double, 1e-5); BOOST_CHECK_CLOSE(i_double , o_double, 1e-5);
} }
} }

2
vs2013/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*/Debug
*/Release

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2F374733-FCA8-4CBB-91A0-2B0B34393D86}</ProjectGuid>
<RootNamespace>performance</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\performance.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\performance.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DAC23DBB-630B-46B9-B115-F1449697898A}</ProjectGuid>
<RootNamespace>sandbox</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{52E96EC3-125A-4525-BC72-F3C524F24640}</ProjectGuid>
<RootNamespace>sandbox_json</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox_json.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox_json.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C81EF3F9-7849-4506-898C-85D0D564CD6A}</ProjectGuid>
<RootNamespace>sandbox_rtti</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_54;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox_rtti.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox_rtti.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}</ProjectGuid>
<RootNamespace>sandbox_vs</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox_vs.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\sandbox_vs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}</ProjectGuid>
<RootNamespace>unittests</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(SolutionDir)\..\include;C:\Boost\include\boost-1_55;$(IncludePath)</IncludePath>
<LibraryPath>C:\Boost\lib\x64;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<SuppressStartupBanner>true</SuppressStartupBanner>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\unittests.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\unittests.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

76
vs2013/vs2013.sln Normal file
View File

@@ -0,0 +1,76 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.20617.1 PREVIEW
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sandbox_vs", "sandbox_vs\sandbox_vs.vcxproj", "{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sandbox_json", "sandbox_json\sandbox_json.vcxproj", "{52E96EC3-125A-4525-BC72-F3C524F24640}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sandbox", "sandbox\sandbox.vcxproj", "{DAC23DBB-630B-46B9-B115-F1449697898A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sandbox_rtti", "sandbox_rtti\sandbox_rtti.vcxproj", "{C81EF3F9-7849-4506-898C-85D0D564CD6A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittests", "unittests\unittests.vcxproj", "{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "performance", "performance\performance.vcxproj", "{2F374733-FCA8-4CBB-91A0-2B0B34393D86}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Debug|Win32.ActiveCfg = Debug|Win32
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Debug|Win32.Build.0 = Debug|Win32
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Debug|x64.ActiveCfg = Debug|x64
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Debug|x64.Build.0 = Debug|x64
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Release|Win32.ActiveCfg = Release|Win32
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Release|Win32.Build.0 = Release|Win32
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Release|x64.ActiveCfg = Release|x64
{A67E36D2-32BE-4D4D-BA2E-8FD59378E734}.Release|x64.Build.0 = Release|x64
{52E96EC3-125A-4525-BC72-F3C524F24640}.Debug|Win32.ActiveCfg = Debug|Win32
{52E96EC3-125A-4525-BC72-F3C524F24640}.Debug|Win32.Build.0 = Debug|Win32
{52E96EC3-125A-4525-BC72-F3C524F24640}.Debug|x64.ActiveCfg = Debug|x64
{52E96EC3-125A-4525-BC72-F3C524F24640}.Debug|x64.Build.0 = Debug|x64
{52E96EC3-125A-4525-BC72-F3C524F24640}.Release|Win32.ActiveCfg = Release|Win32
{52E96EC3-125A-4525-BC72-F3C524F24640}.Release|Win32.Build.0 = Release|Win32
{52E96EC3-125A-4525-BC72-F3C524F24640}.Release|x64.ActiveCfg = Release|x64
{52E96EC3-125A-4525-BC72-F3C524F24640}.Release|x64.Build.0 = Release|x64
{DAC23DBB-630B-46B9-B115-F1449697898A}.Debug|Win32.ActiveCfg = Debug|Win32
{DAC23DBB-630B-46B9-B115-F1449697898A}.Debug|Win32.Build.0 = Debug|Win32
{DAC23DBB-630B-46B9-B115-F1449697898A}.Debug|x64.ActiveCfg = Debug|x64
{DAC23DBB-630B-46B9-B115-F1449697898A}.Debug|x64.Build.0 = Debug|x64
{DAC23DBB-630B-46B9-B115-F1449697898A}.Release|Win32.ActiveCfg = Release|Win32
{DAC23DBB-630B-46B9-B115-F1449697898A}.Release|Win32.Build.0 = Release|Win32
{DAC23DBB-630B-46B9-B115-F1449697898A}.Release|x64.ActiveCfg = Release|x64
{DAC23DBB-630B-46B9-B115-F1449697898A}.Release|x64.Build.0 = Release|x64
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Debug|Win32.ActiveCfg = Debug|Win32
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Debug|Win32.Build.0 = Debug|Win32
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Debug|x64.ActiveCfg = Debug|x64
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Debug|x64.Build.0 = Debug|x64
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Release|Win32.ActiveCfg = Release|Win32
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Release|Win32.Build.0 = Release|Win32
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Release|x64.ActiveCfg = Release|x64
{C81EF3F9-7849-4506-898C-85D0D564CD6A}.Release|x64.Build.0 = Release|x64
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Debug|Win32.ActiveCfg = Debug|Win32
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Debug|Win32.Build.0 = Debug|Win32
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Debug|x64.ActiveCfg = Debug|x64
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Debug|x64.Build.0 = Debug|x64
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Release|Win32.ActiveCfg = Release|Win32
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Release|Win32.Build.0 = Release|Win32
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Release|x64.ActiveCfg = Release|x64
{D447E13A-97A4-4907-9F61-A9BCCDB91EF7}.Release|x64.Build.0 = Release|x64
{2F374733-FCA8-4CBB-91A0-2B0B34393D86}.Debug|Win32.ActiveCfg = Debug|Win32
{2F374733-FCA8-4CBB-91A0-2B0B34393D86}.Debug|Win32.Build.0 = Debug|Win32
{2F374733-FCA8-4CBB-91A0-2B0B34393D86}.Debug|x64.ActiveCfg = Debug|x64
{2F374733-FCA8-4CBB-91A0-2B0B34393D86}.Release|Win32.ActiveCfg = Release|Win32
{2F374733-FCA8-4CBB-91A0-2B0B34393D86}.Release|Win32.Build.0 = Release|Win32
{2F374733-FCA8-4CBB-91A0-2B0B34393D86}.Release|x64.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal