Cleaned up tests for OS X, TR1 names spaces and ancient versus modern libstdc++ and libc++. Thanks to Jonathan Wakely for devising the clever test
parent
becea0ef8d
commit
ae0984b4b1
38
smartptr.h
38
smartptr.h
|
|
@ -7,26 +7,26 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if 0
|
// Hack ahead. Apple's standard library does not have C++'s unique_ptr. We can't test
|
||||||
// This must be kept in sync with stdcpp.h because <memory> is included based on the same logic.
|
// for unique_ptr directly because some of the Clangs on Apple fail the same way.
|
||||||
#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1600)) && !defined(__clang__)
|
// However, modern standard libraries have <forward_list>, so we test for it instead.
|
||||||
# include <memory>
|
// Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions.
|
||||||
template<typename T>
|
|
||||||
using auto_ptr = std::unique_ptr<T>;
|
#if (__cplusplus >= 201103L) || (_MSC_VER >= 1600)
|
||||||
#elif defined(__clang__)
|
# if defined(__clang__) && (__has_include(<forward_list>))
|
||||||
# if (__has_include(<tr1/memory>))
|
# define CRYPTOPP_HAVE_UNIQUE_PTR 1
|
||||||
# include <tr1/memory>
|
# else
|
||||||
using std::auto_ptr;
|
# define CRYPTOPP_HAVE_UNIQUE_PTR 1
|
||||||
# endif
|
# endif
|
||||||
#elif (__cplusplus < 201103L)
|
#endif
|
||||||
# include <tr1/memory>
|
|
||||||
using std::auto_ptr;
|
#ifdef CRYPTOPP_HAVE_UNIQUE_PTR
|
||||||
#else
|
// use unique_ptr instead of auto_ptr
|
||||||
# include <memory>
|
template<typename T>
|
||||||
template<typename T>
|
using std::auto_ptr = std::unique_ptr<T>;
|
||||||
using auto_ptr = std::unique_ptr<T>;
|
#else
|
||||||
|
// do nothing; use auto_ptr
|
||||||
#endif
|
#endif
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
template <class T> class simple_ptr
|
template <class T> class simple_ptr
|
||||||
{
|
{
|
||||||
|
|
|
||||||
21
stdcpp.h
21
stdcpp.h
|
|
@ -12,28 +12,17 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
// http://marshall.calepin.co/c-and-xcode-46.html. Apple does some wonky stuff with
|
// http://marshall.calepin.co/c-and-xcode-46.html.
|
||||||
// <memory>, auto_ptr and unique_ptr. Apple's built-in Clang behaves
|
// This include is needed so we can pickup _LIBCPP_VERSION, if needed.
|
||||||
// differently than a LLVM downloaded and compiled CLang. So we fall back to Clang's
|
#if defined(__APPLE__)
|
||||||
// __has_include (http://clang.llvm.org/docs/LanguageExtensions.html#id3).
|
# include <ciso646>
|
||||||
// This must be kept in sync with smartptr.h because auto_ptr and unique_ptr are
|
|
||||||
// brought in based on the same logic.
|
|
||||||
#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1600)) && !defined(__clang__)
|
|
||||||
# include <memory>
|
|
||||||
#elif defined(__clang__)
|
|
||||||
# if (__has_include(<tr1/memory>))
|
|
||||||
# include <tr1/memory>
|
|
||||||
# endif
|
|
||||||
#elif (__cplusplus < 201103L)
|
|
||||||
# include <tr1/memory>
|
|
||||||
#else
|
|
||||||
# include <memory>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <memory>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue