Remove cxx14 compatibility layer from beast

This commit is contained in:
seelabs
2015-10-07 20:46:52 -07:00
parent 7373a26333
commit 8db0094c73
32 changed files with 30 additions and 756 deletions

View File

@@ -25,8 +25,8 @@
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <functional>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <beast/cxx14/utility.h> // <utility>
#include <type_traits>
#include <utility>
namespace beast {
namespace asio {

View File

@@ -28,7 +28,7 @@
#include <cassert>
#include <memory>
#include <exception>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
#include <string>
#include <utility>

View File

@@ -27,7 +27,7 @@
#include <functional>
#include <memory>
#include <mutex>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
#include <utility>
#include <vector>

View File

@@ -28,8 +28,8 @@
#include <iterator>
#include <memory>
#include <string>
#include <type_traits>
#include <vector>
#include <beast/cxx14/type_traits.h> // <type_traits>
namespace beast {

View File

@@ -25,15 +25,17 @@
#include <beast/container/aged_container.h>
#include <beast/chrono/abstract_clock.h>
#include <beast/utility/empty_base_optimization.h>
#include <beast/utility/empty_base_optimization.h>
#include <beast/cxx14/type_traits.h>
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/version.hpp>
#include <beast/cxx14/algorithm.h> // <algorithm>
#include <algorithm>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <memory>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
#include <utility>
namespace beast {

View File

@@ -27,12 +27,12 @@
#include <beast/utility/empty_base_optimization.h>
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/unordered_set.hpp>
#include <beast/cxx14/algorithm.h> // <algorithm>
#include <algorithm>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <memory>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
#include <utility>
/*

View File

@@ -1,94 +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_CXX14_ALGORITHM_H_INCLUDED
#define BEAST_CXX14_ALGORITHM_H_INCLUDED
#include <beast/cxx14/config.h>
#include <beast/cxx14/functional.h>
#include <algorithm>
#if ! BEAST_NO_CXX14_EQUAL
namespace std {
namespace detail {
template <class Pred, class FwdIt1, class FwdIt2>
bool equal (FwdIt1 first1, FwdIt1 last1,
FwdIt2 first2, FwdIt2 last2, Pred pred,
std::input_iterator_tag, std::input_iterator_tag)
{
for (; first1 != last1 && first2 != last2; ++first1, ++first2)
if (! pred (*first1, *first2))
return false;
return first1 == last1 && first2 == last2;
}
template <class Pred, class RanIt1, class RanIt2>
bool equal (RanIt1 first1, RanIt1 last1,
RanIt2 first2, RanIt2 last2, Pred pred,
random_access_iterator_tag,
random_access_iterator_tag )
{
if (std::distance (first1, last1) !=
std::distance (first2, last2))
return false;
for (; first1 != last1; ++first1, ++first2)
if (! pred (*first1, *first2))
return false;
return true;
}
}
/** C++14 implementation of std::equal. */
/** @{ */
template <class FwdIt1, class FwdIt2>
bool equal (FwdIt1 first1, FwdIt1 last1,
FwdIt2 first2, FwdIt2 last2)
{
return std::detail::equal (first1, last1,
first2, last2, std::equal_to <void>(),
typename std::iterator_traits <
FwdIt1>::iterator_category(),
typename std::iterator_traits <
FwdIt2>::iterator_category());
}
template <class FwdIt1, class FwdIt2, class Pred>
bool equal (FwdIt1 first1, FwdIt1 last1,
FwdIt2 first2, FwdIt2 last2, Pred pred)
{
return std::detail::equal <
typename std::add_lvalue_reference <Pred>::type> (
first1, last1, first2, last2, pred,
typename std::iterator_traits <
FwdIt1>::iterator_category(),
typename std::iterator_traits <
FwdIt2>::iterator_category());
}
/** @} */
}
#endif
#endif

View File

@@ -1,90 +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_CXX14_CONFIG_H_INCLUDED
#define BEAST_CXX14_CONFIG_H_INCLUDED
#include <ciso646> // detect libc++ verison
// Sets C++14 compatibility configuration macros based on build environment
// Disables beast c++14 compatibility additions when set to 1
// Note, some compatibilty features are enabled or disabled individually.
//
#ifndef BEAST_NO_CXX14_COMPATIBILITY
# ifdef _MSC_VER
# define BEAST_NO_CXX14_COMPATIBILITY 1
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
# define BEAST_NO_CXX14_COMPATIBILITY 1
# else
# define BEAST_NO_CXX14_COMPATIBILITY 0
# endif
#endif
// Disables beast's std::make_unique
#ifndef BEAST_NO_CXX14_MAKE_UNIQUE
# ifdef _MSC_VER
# define BEAST_NO_CXX14_MAKE_UNIQUE 1
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
# define BEAST_NO_CXX14_MAKE_UNIQUE 1
# else
# define BEAST_NO_CXX14_MAKE_UNIQUE 0
# endif
#endif
// Disables beast's std::equal safe iterator overloads
#ifndef BEAST_NO_CXX14_EQUAL
# if defined(_MSC_VER) && _MSC_VER >= 1900
# define BEAST_NO_CXX14_EQUAL 1
# elif defined(_MSC_VER)
# define BEAST_NO_CXX14_EQUAL 0
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
# define BEAST_NO_CXX14_EQUAL 1
# else
# define BEAST_NO_CXX14_EQUAL 0
# endif
#endif
// Disables beast's std::integer_sequence
#ifndef BEAST_NO_CXX14_INTEGER_SEQUENCE
# if defined(_MSC_VER) && _MSC_VER >= 1900
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 1
# elif defined(_MSC_VER)
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 0
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 1
# else
# define BEAST_NO_CXX14_INTEGER_SEQUENCE 0
# endif
#endif
// Disables beast's std::make_reverse_iterator
#ifndef BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR
# if defined(_MSC_VER) && _MSC_VER >= 1900
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 1
# elif defined(_MSC_VER)
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 0
# elif defined(__clang__) && defined(_LIBCPP_VERSION) && __cplusplus >= 201402
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 1
# else
# define BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR 0
# endif
#endif
#endif

View File

@@ -1,20 +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.
*/
//==============================================================================
#include <beast/cxx14/tests/integer_sequence.test.cpp>

View File

@@ -1,53 +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_CXX14_FUNCTIONAL_H_INCLUDED
#define BEAST_CXX14_FUNCTIONAL_H_INCLUDED
#include <beast/cxx14/config.h>
#include <functional>
#include <type_traits>
#include <utility>
#if ! BEAST_NO_CXX14_COMPATIBILITY
namespace std {
// C++14 implementation of std::equal_to <void> specialization.
// This supports heterogeneous comparisons.
template <>
struct equal_to <void>
{
// VFALCO NOTE Its not clear how to support is_transparent pre c++14
using is_transparent = std::true_type;
template <class T, class U>
auto operator() (T&& lhs, U&& rhs) const ->
decltype (std::forward <T> (lhs) == std::forward <U> (rhs))
{
return std::forward <T> (lhs) == std::forward <U> (rhs);
}
};
}
#endif
#endif

View File

@@ -1,45 +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_CXX14_ITERATOR_H_INCLUDED
#define BEAST_CXX14_ITERATOR_H_INCLUDED
#include <beast/cxx14/config.h>
#include <iterator>
#if ! BEAST_NO_CXX14_MAKE_REVERSE_ITERATOR
namespace std {
// C++14 implementation of std::make_reverse_iterator to allow creation of a
// reverse iterator from a given iterator.
template <class Iter>
inline
reverse_iterator<Iter>
make_reverse_iterator(Iter i)
{
return reverse_iterator<Iter>(i);
}
}
#endif
#endif

View File

@@ -1,39 +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_CXX14_MEMORY_H_INCLUDED
#define BEAST_CXX14_MEMORY_H_INCLUDED
#include <beast/cxx14/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

View File

@@ -1,113 +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.
*/
//==============================================================================
#if BEAST_INCLUDE_BEASTCONFIG
#include <BeastConfig.h>
#endif
#if ! BEAST_NO_CXX14_INTEGER_SEQUENCE
#include <beast/cxx14/utility.h>
#include <beast/unit_test/suite.h>
namespace beast {
namespace asio {
class integer_sequence_test : public unit_test::suite
{
public:
template <class AtContainer, class T, T... I>
static
auto
extract (AtContainer const& t,
std::integer_sequence <T, I...>) ->
decltype (std::make_tuple (std::get <I> (t)...))
{
return std::make_tuple (std::get <I> (t)...);
}
void run()
{
// Code from
// http://llvm.org/svn/llvm-project/libcxx/trunk/test/utilities/intseq/intseq.general/integer_seq.pass.cpp
// Make a couple of sequences
using int3 = std::make_integer_sequence<int, 3>; // generates int: 0,1,2
using size7 = std::make_integer_sequence<size_t, 7>; // generates size_t: 0,1,2,3,4,5,6
using size4 = std::make_index_sequence<4>; // generates size_t: 0,1,2,3
using size2 = std::index_sequence_for<int, size_t>; // generates size_t: 0,1
using intmix = std::integer_sequence<int, 9, 8, 7, 2>; // generates int: 9,8,7,2
using sizemix = std::index_sequence<1, 1, 2, 3, 5>; // generates size_t: 1,1,2,3,5
// Make sure they're what we expect
static_assert ( std::is_same <int3::value_type, int>::value, "int3 type wrong" );
static_assert ( int3::static_size == 3, "int3 size wrong" );
static_assert ( std::is_same <size7::value_type, size_t>::value, "size7 type wrong" );
static_assert ( size7::static_size == 7, "size7 size wrong" );
static_assert ( std::is_same <size4::value_type, size_t>::value, "size4 type wrong" );
static_assert ( size4::static_size == 4, "size4 size wrong" );
static_assert ( std::is_same <size2::value_type, size_t>::value, "size2 type wrong" );
static_assert ( size2::static_size == 2, "size2 size wrong" );
static_assert ( std::is_same <intmix::value_type, int>::value, "intmix type wrong" );
static_assert ( intmix::static_size == 4, "intmix size wrong" );
static_assert ( std::is_same <sizemix::value_type, size_t>::value, "sizemix type wrong" );
static_assert ( sizemix::static_size == 5, "sizemix size wrong" );
auto tup = std::make_tuple ( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 );
// Use them
auto t3 = extract ( tup, int3() );
static_assert ( std::tuple_size<decltype(t3)>::value == int3::static_size, "t3 size wrong");
expect ( t3 == std::make_tuple ( 10, 11, 12 ));
auto t7 = extract ( tup, size7 ());
static_assert ( std::tuple_size<decltype(t7)>::value == size7::static_size, "t7 size wrong");
expect ( t7 == std::make_tuple ( 10, 11, 12, 13, 14, 15, 16 ));
auto t4 = extract ( tup, size4 ());
static_assert ( std::tuple_size<decltype(t4)>::value == size4::static_size, "t4 size wrong");
expect ( t4 == std::make_tuple ( 10, 11, 12, 13 ));
auto t2 = extract ( tup, size2 ());
static_assert ( std::tuple_size<decltype(t2)>::value == size2::static_size, "t2 size wrong");
expect ( t2 == std::make_tuple ( 10, 11 ));
auto tintmix = extract ( tup, intmix ());
static_assert ( std::tuple_size<decltype(tintmix)>::value == intmix::static_size, "tintmix size wrong");
expect ( tintmix == std::make_tuple ( 19, 18, 17, 12 ));
auto tsizemix = extract ( tup, sizemix ());
static_assert ( std::tuple_size<decltype(tsizemix)>::value == sizemix::static_size, "tsizemix size wrong");
expect ( tsizemix == std::make_tuple ( 11, 11, 12, 13, 15 ));
pass();
}
};
BEAST_DEFINE_TESTSUITE(integer_sequence,cxx14,beast);
}
}
#endif

View File

@@ -20,8 +20,6 @@
#ifndef BEAST_CXX14_TYPE_TRAITS_H_INCLUDED
#define BEAST_CXX14_TYPE_TRAITS_H_INCLUDED
#include <beast/cxx14/config.h>
#include <tuple>
#include <type_traits>
#include <utility>
@@ -43,105 +41,6 @@ struct is_constructible <pair <T, U>>
{
};
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

View File

@@ -1,173 +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_CXX14_UTILITY_H_INCLUDED
#define BEAST_CXX14_UTILITY_H_INCLUDED
#include <beast/cxx14/config.h>
#include <cstddef>
#include <type_traits>
#include <utility>
#if ! BEAST_NO_CXX14_INTEGER_SEQUENCE
namespace std {
template <class T, T... Ints>
struct integer_sequence
{
using value_type = T;
static_assert (is_integral<T>::value,
"std::integer_sequence can only be instantiated with an integral type" );
static const size_t static_size = sizeof...(Ints);
static /* constexpr */ size_t size() /* noexcept */
{
return sizeof...(Ints);
}
};
template <size_t... Ints>
using index_sequence = integer_sequence <size_t, Ints...>;
namespace detail {
// This workaround is needed for msvc broken sizeof...
template <class... Args>
struct sizeof_workaround
{
static size_t const size = sizeof... (Args);
};
} // detail
#ifdef _MSC_VER
// This implementation compiles on MSVC and clang but not gcc
namespace detail {
template <class T, unsigned long long N, class Seq>
struct make_integer_sequence_unchecked;
template <class T, unsigned long long N, unsigned long long ...Indices>
struct make_integer_sequence_unchecked <
T, N, integer_sequence <T, Indices...>>
{
using type = typename make_integer_sequence_unchecked<
T, N-1, integer_sequence<T, N-1, Indices...>>::type;
};
template <class T, unsigned long long ...Indices>
struct make_integer_sequence_unchecked <
T, 0, integer_sequence<T, Indices...>>
{
using type = integer_sequence <T, Indices...>;
};
template <class T, T N>
struct make_integer_sequence_checked
{
static_assert (is_integral <T>::value,
"T must be an integral type");
static_assert (N >= 0,
"N must be non-negative");
using type = typename make_integer_sequence_unchecked <
T, N, integer_sequence<T>>::type;
};
} // detail
template <class T, T N>
using make_integer_sequence =
typename detail::make_integer_sequence_checked <T, N>::type;
template <size_t N>
using make_index_sequence = make_integer_sequence <size_t, N>;
template <class... Args>
using index_sequence_for =
make_index_sequence <detail::sizeof_workaround <Args...>::size>;
#else
// This implementation compiles on gcc but not MSVC
namespace detail {
template <size_t... Ints>
struct index_tuple
{
using next = index_tuple <Ints..., sizeof... (Ints)>;
};
template <size_t N>
struct build_index_tuple
{
using type = typename build_index_tuple <N-1>::type::next;
};
template <>
struct build_index_tuple <0>
{
using type = index_tuple<>;
};
template <class T, T N,
class Seq = typename build_index_tuple <N>::type
>
struct make_integer_sequence;
template <class T, T N, size_t... Ints>
struct make_integer_sequence <T, N, index_tuple <Ints...>>
{
static_assert (is_integral <T>::value,
"T must be an integral type");
static_assert (N >= 0,
"N must be non-negative");
using type = integer_sequence <T, static_cast <T> (Ints)...>;
};
} // detail
template <class T, T N>
using make_integer_sequence =
typename detail::make_integer_sequence <T, N>::type;
template <size_t N>
using make_index_sequence = make_integer_sequence <size_t, N>;
template <class... Args>
using index_sequence_for =
make_index_sequence <detail::sizeof_workaround <Args...>::size>;
#endif
}
#endif
#endif

View File

@@ -23,7 +23,7 @@
#include <cstddef>
#include <cstdint>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {

View File

@@ -36,8 +36,8 @@
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <beast/cxx14/utility.h> // <utility>
#include <type_traits>
#include <utility>
#include <vector>
namespace beast {

View File

@@ -28,7 +28,7 @@
#include <beast/hash/endian.h>
#include <beast/hash/impl/xxhash.h>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
#include <cstddef>
namespace beast {

View File

@@ -25,7 +25,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/streambuf.hpp>
#include <boost/optional.hpp>
#include <beast/cxx14/memory.h> // <memory>
#include <memory>
#include <string>
namespace beast {

View File

@@ -26,7 +26,7 @@
#include <cassert>
#include <cstddef>
#include <iterator>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {
namespace http {

View File

@@ -19,7 +19,7 @@
#include <unordered_map>
#include <beast/hash/uhash.h>
#include <beast/cxx14/memory.h> // <memory>
#include <memory>
namespace beast {
namespace insight {

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_IS_CALL_POSSIBLE_H_INCLUDED
#define BEAST_IS_CALL_POSSIBLE_H_INCLUDED
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {

View File

@@ -21,7 +21,7 @@
*/
//==============================================================================
#include <beast/cxx14/memory.h> // <memory>
#include <memory>
namespace beast {

View File

@@ -28,7 +28,7 @@
#include <iterator>
#include <limits>
#include <string>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
#include <typeinfo>
#include <utility>

View File

@@ -25,7 +25,7 @@
#include <cstddef>
#include <cstdint>
#include <stdexcept>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {
namespace nudb {

View File

@@ -31,7 +31,7 @@
#include <cstring>
#include <memory>
#include <stdexcept>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {
namespace nudb {

View File

@@ -23,7 +23,7 @@
#include <beast/config/CompilerConfig.h> // for BEAST_CONSTEXPR
#include <beast/nudb/detail/stream.h>
#include <cstdint>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {
namespace nudb {

View File

@@ -45,7 +45,7 @@
#include <cstring>
#include <exception>
#include <limits>
#include <beast/cxx14/memory.h> // <memory>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <string>

View File

@@ -23,7 +23,7 @@
#include <array>
#include <cstdint>
#include <cstring>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_STREAMS_BASIC_SCOPED_OSTREAM_H_INCLUDED
#define BEAST_STREAMS_BASIC_SCOPED_OSTREAM_H_INCLUDED
#include <beast/cxx14/memory.h> // <memory>
#include <memory>
#include <functional>
#include <memory>

View File

@@ -20,8 +20,8 @@
#ifndef BEAST_UTILITY_CI_CHAR_TRAITS_H_INCLUDED
#define BEAST_UTILITY_CI_CHAR_TRAITS_H_INCLUDED
#include <beast/cxx14/algorithm.h> // <algorithm>
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <algorithm>
#include <type_traits>
#include <cctype>
#include <iterator>
#include <string>

View File

@@ -20,7 +20,7 @@
#ifndef BEAST_UTILITY_META_H_INCLUDED
#define BEAST_UTILITY_META_H_INCLUDED
#include <beast/cxx14/type_traits.h> // <type_traits>
#include <type_traits>
namespace beast {