Skip to content

Commit

Permalink
Also for #44, need to test type_traits on load_and_allocate
Browse files Browse the repository at this point in the history
  • Loading branch information
AzothAmmo committed Jan 22, 2014
1 parent 00b18c4 commit 9d4f51e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions include/cereal/details/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ namespace cereal
};
} // namespace detail

// forward decl
namespace memory_detail{ template <class Ar, class T> struct LoadAndAllocateLoadWrapper; }

//! Used to allocate types with no default constructor
/*! When serializing a type that has no default constructor, cereal
Expand All @@ -347,15 +349,14 @@ namespace cereal
}

private:
template <class A, class B> friend struct memory_detail::LoadAndAllocateLoadWrapper;
template <class A, class B> friend struct ::cereal::memory_detail::LoadAndAllocateLoadWrapper;

allocate( T * p ) : ptr( p ) {}
allocate( allocate const & ) = delete;
allocate & operator=( allocate const & ) = delete;

T * ptr;
};

} // namespace cereal

#endif // CEREAL_DETAILS_HELPERS_HPP_
4 changes: 2 additions & 2 deletions sandbox_vs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ namespace cereal
struct LoadAndAllocate<Test>
{
template <class Archive>
static Test * load_and_allocate( Archive & )
static void load_and_allocate( Archive &, cereal::allocate<Test> & allocate )
{
return new Test();
allocate();
}
};
}
Expand Down

0 comments on commit 9d4f51e

Please sign in to comment.