mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 11:15:56 +00:00
Consolidate C++14 compatibility into new headers
This commit is contained in:
@@ -138,9 +138,12 @@
|
||||
<ClInclude Include="..\..\beast\crypto\UnsignedInteger.h" />
|
||||
<ClInclude Include="..\..\beast\crypto\UnsignedIntegerCalc.h" />
|
||||
<ClInclude Include="..\..\beast\CStdInt.h" />
|
||||
<ClInclude Include="..\..\beast\cxx14\algorithm.h" />
|
||||
<ClInclude Include="..\..\beast\cxx14\config.h" />
|
||||
<ClInclude Include="..\..\beast\cxx14\functional.h" />
|
||||
<ClInclude Include="..\..\beast\cxx14\memory.h" />
|
||||
<ClInclude Include="..\..\beast\cxx14\type_traits.h" />
|
||||
<ClInclude Include="..\..\beast\cyclic_iterator.h" />
|
||||
<ClInclude Include="..\..\beast\equal.h" />
|
||||
<ClInclude Include="..\..\beast\equal_to.h" />
|
||||
<ClInclude Include="..\..\beast\FixedArray.h" />
|
||||
<ClInclude Include="..\..\beast\HeapBlock.h" />
|
||||
<ClInclude Include="..\..\beast\HTTP.h" />
|
||||
@@ -168,8 +171,6 @@
|
||||
<ClInclude Include="..\..\beast\Intrusive.h" />
|
||||
<ClInclude Include="..\..\beast\intrusive\List.h" />
|
||||
<ClInclude Include="..\..\beast\intrusive\LockFreeStack.h" />
|
||||
<ClInclude Include="..\..\beast\is_constructible.h" />
|
||||
<ClInclude Include="..\..\beast\make_unique.h" />
|
||||
<ClInclude Include="..\..\beast\Memory.h" />
|
||||
<ClInclude Include="..\..\beast\MPL.h" />
|
||||
<ClInclude Include="..\..\beast\mpl\IsCallPossible.h" />
|
||||
|
||||
@@ -306,6 +306,9 @@
|
||||
<Filter Include="beast\intrusive">
|
||||
<UniqueIdentifier>{8832eb52-53f9-4850-8dc9-1d579a386a0e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="beast\cxx14">
|
||||
<UniqueIdentifier>{5745a887-7df8-4059-87ea-e0c7eea77a9b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
||||
@@ -1212,9 +1215,6 @@
|
||||
<ClInclude Include="..\..\beast\asio\io_latency_probe.h">
|
||||
<Filter>beast\asio</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\make_unique.h">
|
||||
<Filter>beast</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\insight\Base.h">
|
||||
<Filter>beast\insight</Filter>
|
||||
</ClInclude>
|
||||
@@ -1269,12 +1269,6 @@
|
||||
<ClInclude Include="..\..\beast\chrono\ScopedTimeInterval.h">
|
||||
<Filter>beast\chrono</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\equal_to.h">
|
||||
<Filter>beast</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\equal.h">
|
||||
<Filter>beast</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\type_traits\maybe_const.h">
|
||||
<Filter>beast\type_traits</Filter>
|
||||
</ClInclude>
|
||||
@@ -1320,15 +1314,27 @@
|
||||
<ClInclude Include="..\..\beast\container\detail\aged_associative_container.h">
|
||||
<Filter>beast\container\detail</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\is_constructible.h">
|
||||
<Filter>beast</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\container\aged_container_utility.h">
|
||||
<Filter>beast\container</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\container\aged_container.h">
|
||||
<Filter>beast\container</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\cxx14\type_traits.h">
|
||||
<Filter>beast\cxx14</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\cxx14\functional.h">
|
||||
<Filter>beast\cxx14</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\cxx14\config.h">
|
||||
<Filter>beast\cxx14</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\cxx14\algorithm.h">
|
||||
<Filter>beast\cxx14</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\beast\cxx14\memory.h">
|
||||
<Filter>beast\cxx14</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\modules\beast_core\containers\DynamicObject.cpp">
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
#include "aged_container_iterator.h"
|
||||
#include "aged_associative_container.h"
|
||||
|
||||
#include "../../cxx14/algorithm.h"
|
||||
#include "../../cxx14/type_traits.h"
|
||||
|
||||
#include "../aged_container.h"
|
||||
|
||||
#include "../../chrono/abstract_clock.h"
|
||||
#include "../../equal.h"
|
||||
#include "../../equal_to.h"
|
||||
#include "../../is_constructible.h"
|
||||
#include "../../utility/empty_base_optimization.h"
|
||||
|
||||
#include <boost/intrusive/list.hpp>
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace beast {
|
||||
|
||||
@@ -26,19 +26,17 @@
|
||||
#include "../aged_container.h"
|
||||
|
||||
#include "../../chrono/abstract_clock.h"
|
||||
#include "../../equal.h"
|
||||
#include "../../equal_to.h"
|
||||
#include "../../is_constructible.h"
|
||||
#include "../../utility/empty_base_optimization.h"
|
||||
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
|
||||
#include "../../cxx14/algorithm.h"
|
||||
#include "../../cxx14/type_traits.h"
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
/*
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "../../../modules/beast_core/beast_core.h" // for UnitTest
|
||||
#include "../../chrono/manual_clock.h"
|
||||
#include "../../equal.h"
|
||||
#include "../aged_set.h"
|
||||
#include "../aged_map.h"
|
||||
#include "../aged_multiset.h"
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_EQUAL_H_INCLUDED
|
||||
#define BEAST_EQUAL_H_INCLUDED
|
||||
#ifndef BEAST_CXX14_ALGORITHM_H_INCLUDED
|
||||
#define BEAST_CXX14_ALGORITHM_H_INCLUDED
|
||||
|
||||
#include "equal_to.h"
|
||||
#include "config.h"
|
||||
#include "functional.h"
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
namespace std {
|
||||
|
||||
44
beast/cxx14/config.h
Normal file
44
beast/cxx14/config.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CXX14_CONFIG_H_INCLUDED
|
||||
#define BEAST_CXX14_CONFIG_H_INCLUDED
|
||||
|
||||
// Sets C++14 compatibility configuration macros based on build environment
|
||||
|
||||
// Disables beast c++14 compatibility additions when set to 1
|
||||
//
|
||||
#ifndef BEAST_NO_CXX14_COMPATIBILITY
|
||||
# ifdef _MSC_VER
|
||||
# define BEAST_NO_CXX14_COMPATIBILITY 1
|
||||
# else
|
||||
# define BEAST_NO_CXX14_COMPATIBILITY 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Disables beast's make_unique
|
||||
#ifndef BEAST_NO_CXX14_MAKE_UNIQUE
|
||||
# ifdef _MSC_VER
|
||||
# define BEAST_NO_CXX14_MAKE_UNIQUE 1
|
||||
# else
|
||||
# define BEAST_NO_CXX14_MAKE_UNIQUE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -17,19 +17,21 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_EQUAL_TO_H_INCLUDED
|
||||
#define BEAST_EQUAL_TO_H_INCLUDED
|
||||
#ifndef BEAST_CXX14_FUNCTIONAL_H_INCLUDED
|
||||
#define BEAST_CXX14_FUNCTIONAL_H_INCLUDED
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if ! BEAST_NO_CXX14_COMPATIBILITY
|
||||
|
||||
namespace std {
|
||||
|
||||
#ifndef _MSC_VER
|
||||
|
||||
/** C++14 implementation of std::equal_to <void> specialization.
|
||||
This supports heterogeneous comparisons.
|
||||
*/
|
||||
// C++14 implementation of std::equal_to <void> specialization.
|
||||
// This supports heterogeneous comparisons.
|
||||
template <>
|
||||
struct equal_to <void>
|
||||
{
|
||||
@@ -44,8 +46,8 @@ struct equal_to <void>
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
41
beast/cxx14/memory.h
Normal file
41
beast/cxx14/memory.h
Normal file
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CXX14_MEMORY_H_INCLUDED
|
||||
#define BEAST_CXX14_MEMORY_H_INCLUDED
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace std {
|
||||
|
||||
#if ! BEAST_NO_CXX14_MAKE_UNIQUE
|
||||
|
||||
template <class T, class... Args>
|
||||
std::unique_ptr <T> make_unique (Args&&... args)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (std::forward <Args> (args)...));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
147
beast/cxx14/type_traits.h
Normal file
147
beast/cxx14/type_traits.h
Normal file
@@ -0,0 +1,147 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_CXX14_TYPE_TRAITS_H_INCLUDED
|
||||
#define BEAST_CXX14_TYPE_TRAITS_H_INCLUDED
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace std {
|
||||
|
||||
// Ideas from Howard Hinnant
|
||||
//
|
||||
// Specializations of is_constructible for pair and tuple which
|
||||
// work around an apparent defect in the standard that causes well
|
||||
// formed expressions involving pairs or tuples of non default-constructible
|
||||
// types to generate compile errors.
|
||||
//
|
||||
template <class T, class U>
|
||||
struct is_constructible <pair <T, U>>
|
||||
: integral_constant <bool,
|
||||
is_default_constructible <T>::value &&
|
||||
is_default_constructible <U>::value>
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <bool...>
|
||||
struct compile_time_all;
|
||||
|
||||
template <>
|
||||
struct compile_time_all <>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <bool Arg0, bool ... Argn>
|
||||
struct compile_time_all <Arg0, Argn...>
|
||||
{
|
||||
static const bool value =
|
||||
Arg0 && compile_time_all <Argn...>::value;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class ...T>
|
||||
struct is_constructible <tuple <T...>>
|
||||
: integral_constant <bool,
|
||||
detail::compile_time_all <
|
||||
is_default_constructible <T>::value...>::value>
|
||||
{
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if ! BEAST_NO_CXX14_COMPATIBILITY
|
||||
|
||||
// From http://llvm.org/svn/llvm-project/libcxx/trunk/include/type_traits
|
||||
|
||||
// const-volatile modifications:
|
||||
template <class T>
|
||||
using remove_const_t = typename remove_const<T>::type; // C++14
|
||||
template <class T>
|
||||
using remove_volatile_t = typename remove_volatile<T>::type; // C++14
|
||||
template <class T>
|
||||
using remove_cv_t = typename remove_cv<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_const_t = typename add_const<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_volatile_t = typename add_volatile<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_cv_t = typename add_cv<T>::type; // C++14
|
||||
|
||||
// reference modifications:
|
||||
template <class T>
|
||||
using remove_reference_t = typename remove_reference<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14
|
||||
|
||||
// sign modifications:
|
||||
template <class T>
|
||||
using make_signed_t = typename make_signed<T>::type; // C++14
|
||||
template <class T>
|
||||
using make_unsigned_t = typename make_unsigned<T>::type; // C++14
|
||||
|
||||
// array modifications:
|
||||
template <class T>
|
||||
using remove_extent_t = typename remove_extent<T>::type; // C++14
|
||||
template <class T>
|
||||
using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14
|
||||
|
||||
// pointer modifications:
|
||||
template <class T>
|
||||
using remove_pointer_t = typename remove_pointer<T>::type; // C++14
|
||||
template <class T>
|
||||
using add_pointer_t = typename add_pointer<T>::type; // C++14
|
||||
|
||||
// other transformations:
|
||||
|
||||
#if 0
|
||||
// This is not easy to implement in C++11
|
||||
template <size_t Len, std::size_t Align=std::alignment_of<max_align_t>::value>
|
||||
using aligned_storage_t = typename aligned_storage<Len,Align>::type; // C++14
|
||||
template <std::size_t Len, class... Types>
|
||||
using aligned_union_t = typename aligned_union<Len,Types...>::type; // C++14
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
using decay_t = typename decay<T>::type; // C++14
|
||||
template <bool b, class T=void>
|
||||
using enable_if_t = typename enable_if<b,T>::type; // C++14
|
||||
template <bool b, class T, class F>
|
||||
using conditional_t = typename conditional<b,T,F>::type; // C++14
|
||||
template <class... T>
|
||||
using common_type_t = typename common_type<T...>::type; // C++14
|
||||
template <class T>
|
||||
using underlying_type_t = typename underlying_type<T>::type; // C++14
|
||||
template <class F, class... ArgTypes>
|
||||
using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "../../make_unique.h"
|
||||
#include "../../cxx14/memory.h"
|
||||
|
||||
namespace beast {
|
||||
namespace insight {
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Howard Hinnant <howard.hinnant@gmail.com>,
|
||||
Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_IS_CONSTRUCTIBLE_H_INCLUDED
|
||||
#define BEAST_IS_CONSTRUCTIBLE_H_INCLUDED
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <tuple>
|
||||
|
||||
namespace std {
|
||||
|
||||
// Ideas from Howard Hinnant
|
||||
//
|
||||
// Specializations of is_constructible for pair and tuple which
|
||||
// work around an apparent defect in the standard that causes well
|
||||
// formed expressions involving pairs or tuples of non default-constructible
|
||||
// types to generate compile errors.
|
||||
//
|
||||
template <class T, class U>
|
||||
struct is_constructible <pair <T, U>>
|
||||
: integral_constant <bool,
|
||||
is_default_constructible <T>::value &&
|
||||
is_default_constructible <U>::value>
|
||||
{
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <bool...>
|
||||
struct compile_time_all;
|
||||
|
||||
template <>
|
||||
struct compile_time_all <>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <bool Arg0, bool ... Argn>
|
||||
struct compile_time_all <Arg0, Argn...>
|
||||
{
|
||||
static const bool value =
|
||||
Arg0 && compile_time_all <Argn...>::value;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class ...T>
|
||||
struct is_constructible <tuple <T...>>
|
||||
: integral_constant <bool,
|
||||
detail::compile_time_all <
|
||||
is_default_constructible <T>::value...>::value>
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,99 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef BEAST_MAKE_UNIQUE_H_INCLUDED
|
||||
#define BEAST_MAKE_UNIQUE_H_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace std {
|
||||
|
||||
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
# ifdef _MSC_VER
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
|
||||
template <class T>
|
||||
std::unique_ptr <T> make_unique ()
|
||||
{
|
||||
return std::unique_ptr <T> (new T);
|
||||
}
|
||||
|
||||
template <class T, class P1>
|
||||
std::unique_ptr <T> make_unique (P1&& p1)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (std::forward <P1> (p1)));
|
||||
}
|
||||
|
||||
template <class T, class P1, class P2>
|
||||
std::unique_ptr <T> make_unique (P1&& p1, P2&& p2)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (
|
||||
std::forward <P1> (p1), std::forward <P2> (p2)));
|
||||
}
|
||||
|
||||
template <class T, class P1, class P2, class P3>
|
||||
std::unique_ptr <T> make_unique (P1&& p1, P2&& p2, P3&& p3)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (
|
||||
std::forward <P1> (p1), std::forward <P2> (p2), std::forward <P3> (p3)));
|
||||
}
|
||||
|
||||
template <class T, class P1, class P2, class P3, class P4>
|
||||
std::unique_ptr <T> make_unique (P1&& p1, P2&& p2, P3&& p3, P4&& p4)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (
|
||||
std::forward <P1> (p1), std::forward <P2> (p2), std::forward <P3> (p3),
|
||||
std::forward <P4> (p4)));
|
||||
}
|
||||
|
||||
template <class T, class P1, class P2, class P3, class P4, class P5>
|
||||
std::unique_ptr <T> make_unique (P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (
|
||||
std::forward <P1> (p1), std::forward <P2> (p2), std::forward <P3> (p3),
|
||||
std::forward <P4> (p4), std::forward <P5> (p5)));
|
||||
}
|
||||
|
||||
template <class T, class P1, class P2, class P3, class P4, class P5, class P6>
|
||||
std::unique_ptr <T> make_unique (P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (
|
||||
std::forward <P1> (p1), std::forward <P2> (p2), std::forward <P3> (p3),
|
||||
std::forward <P4> (p4), std::forward <P5> (p5), std::forward <P6> (p6)));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#else
|
||||
|
||||
template <class T, class... Args>
|
||||
std::unique_ptr <T> make_unique (Args&&... args)
|
||||
{
|
||||
return std::unique_ptr <T> (new T (std::forward <Args> (args)...));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user