Previously we took the address of the dereferenced begin() iterator
on a string to get the pointer to its data; we now just const_cast
the pointer that is the result of calling data().
The original reason for using the iterator over something like data()
was to avoid the const_cast and to ensure that any copy on write
mechanisms were used, but this doesn't seem necessary given that we
call resize() immediately prior to this. Valgrind shows no problems
with the new method. Also added unit tests for this case to string.
Fixes#47
When we detect a shared_ptr being loaded in load_and_allocate that
also is of a type that derives from enable_shared_from_this, extra
work is done to save the state of the enable_shared_from_this before
the user gets to meddle with it via placement new inside of
cereal::allocate. State is restored after getting back from the user.
load_and_allocate did not properly enter into the 'data' NVP that the
ptr_wrapper creates for unique/shared ptr. When loading these types,
we now go through a wrapper struct to force entry into an extra node to
resolve this issue.
Changes to unittests are for an issue compiling with g++-4.7.3 under
Ubuntu where steady_clock::now() is not defined for some reason
closes#38
Added a preprocessor define CEREAL_OLDER_GCC that exists if using
any GCC 4.7.x or earlier. If this is defined some type traits change to
our original solution (prior to VS compatible), which is probably what we'd switch
to if VS ever gets around to fully supporting SFINAE and constexpr.
In map and set, as well as in unit tests, use insert instead of emplace for 4.7.x.
See issue #17
Somewhere along the way we've also broken our ability to compile with GCC 4.7.3. We'll have to decide if we care about
supporting 4.7.3 or not. The changes that break this are:
-there is no emplace in std::map (or related) in 4.7.3
-there are some enable_ifs in rapidjson's writer.h that are always false (which is fine), but
GCC 4.7.3 doesn't like this
All containers that used insert during loads (map, unordered_map, set, unordered_set)
now use emplace or emplace_hint and move their loaded values into position.
Errors in unittests turned out to be errors in the way the tests were written,
not in the actual XML archive.
Additional errors were due to improper loads in vector<bool>, which is now
fixed.
XML out of order seems to be working fine but the unit tests are running into a crash on the out of order test, which
doesn't show up in the sandbox version of the same thing. Need to debug this and out of order should be good to go
for XML.
Still todo:
* Build under debug/release for both 32 and 64 bit
* make a project for performance
* clean up code specific for vs and take a careful look at the changes that json.hpp needed
Added some documentation to XML output archive describing how it works.
Added attribute size="dynamic" to types that specify a size tag for XML, making it easier for a human to figure out what
they can add or remove data from.
Documentation updates on a few other things.
Some things are failing, will need to look at this later.
string test is commented out for XML since it doesn't work with wchar yet
priority_queue test is commented out for XML since it doesn't work with empty structs automatically