Further compatibility fixes for GCC 4.8
This commit is contained in:
parent
5269734003
commit
9516d4facc
@ -7,10 +7,38 @@
|
|||||||
#if __GNUC__ == 4 && __GNUC_MINOR__ == 8
|
#if __GNUC__ == 4 && __GNUC_MINOR__ == 8
|
||||||
// Add std::make_unique
|
// Add std::make_unique
|
||||||
namespace std {
|
namespace std {
|
||||||
template<typename T, typename... Args>
|
/// Alias template for remove_extent
|
||||||
inline unique_ptr<T> make_unique(Args&&... args) {
|
template<typename _Tp>
|
||||||
return unique_ptr<T>(new T(std::forward<Args>(args)...));
|
using remove_extent_t = typename remove_extent<_Tp>::type;
|
||||||
}
|
|
||||||
|
template<typename _Tp>
|
||||||
|
struct _MakeUniq
|
||||||
|
{ typedef unique_ptr<_Tp> __single_object; };
|
||||||
|
|
||||||
|
template<typename _Tp>
|
||||||
|
struct _MakeUniq<_Tp[]>
|
||||||
|
{ typedef unique_ptr<_Tp[]> __array; };
|
||||||
|
|
||||||
|
template<typename _Tp, size_t _Bound>
|
||||||
|
struct _MakeUniq<_Tp[_Bound]>
|
||||||
|
{ struct __invalid_type { }; };
|
||||||
|
|
||||||
|
/// std::make_unique for single objects
|
||||||
|
template<typename _Tp, typename... _Args>
|
||||||
|
inline typename _MakeUniq<_Tp>::__single_object
|
||||||
|
make_unique(_Args&&... __args)
|
||||||
|
{ return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
|
||||||
|
|
||||||
|
/// std::make_unique for arrays of unknown bound
|
||||||
|
template<typename _Tp>
|
||||||
|
inline typename _MakeUniq<_Tp>::__array
|
||||||
|
make_unique(size_t __num)
|
||||||
|
{ return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); }
|
||||||
|
|
||||||
|
/// Disable std::make_unique for arrays of known bound
|
||||||
|
template<typename _Tp, typename... _Args>
|
||||||
|
inline typename _MakeUniq<_Tp>::__invalid_type
|
||||||
|
make_unique(_Args&&...) = delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <blockstore/implementations/testfake/FakeBlockStore.h>
|
#include <blockstore/implementations/testfake/FakeBlockStore.h>
|
||||||
#include "blobstore/implementations/onblocks/BlobStoreOnBlocks.h"
|
#include "blobstore/implementations/onblocks/BlobStoreOnBlocks.h"
|
||||||
|
#include <cpp-utils/pointer/gcc_4_8_compatibility.h>
|
||||||
|
|
||||||
using blobstore::onblocks::BlobStoreOnBlocks;
|
using blobstore::onblocks::BlobStoreOnBlocks;
|
||||||
using blockstore::testfake::FakeBlockStore;
|
using blockstore::testfake::FakeBlockStore;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <cpp-utils/system/memory.h>
|
#include <cpp-utils/system/memory.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <cpp-utils/pointer/gcc_4_8_compatibility.h>
|
||||||
|
|
||||||
using cpputils::DontSwapMemoryRAII;
|
using cpputils::DontSwapMemoryRAII;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user