forked from OSchip/llvm-project
parent
7a9f500fcb
commit
40fde4d33e
|
@ -20,6 +20,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Ptr {};
|
struct Ptr {};
|
||||||
|
|
||||||
|
@ -47,9 +49,19 @@ struct C
|
||||||
typedef CPtr<const T> const_pointer;
|
typedef CPtr<const T> const_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct D {
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef void const_pointer;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::const_pointer, Ptr<const char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::const_pointer, Ptr<const char> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<D<char> >::const_pointer, const char*>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Ptr {};
|
struct Ptr {};
|
||||||
|
|
||||||
|
@ -47,9 +49,21 @@ struct C
|
||||||
typedef CPtr<const void> const_void_pointer;
|
typedef CPtr<const void> const_void_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct D
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef int const_void_pointer;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::const_void_pointer, Ptr<const void> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::const_void_pointer, const void*>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<C<char> >::const_void_pointer, CPtr<const void> >::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<D<char> >::const_void_pointer, const void*>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -43,6 +45,15 @@ struct C
|
||||||
struct const_void_pointer {};
|
struct const_void_pointer {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct D
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef void difference_type;
|
||||||
|
};
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -59,4 +70,7 @@ int main()
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::difference_type, short>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::difference_type, std::ptrdiff_t>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::difference_type, signed char>::value), "");
|
static_assert((std::is_same<std::allocator_traits<C<char> >::difference_type, signed char>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<D<char> >::difference_type, std::ptrdiff_t>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Ptr {};
|
struct Ptr {};
|
||||||
|
|
||||||
|
@ -35,8 +37,18 @@ struct B
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct C {
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef void pointer;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::pointer, Ptr<char> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::pointer, char*>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<C<char> >::pointer, char*>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -33,8 +35,20 @@ struct B
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct C
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef std::true_type propagate_on_container_copy_assignment;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -33,8 +35,21 @@ struct B
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct C
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef std::true_type propagate_on_container_move_assignment;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_move_assignment, std::true_type>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_move_assignment, std::false_type>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -33,8 +35,19 @@ struct B
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct C
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef std::true_type propagate_on_container_swap;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_swap, std::true_type>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_swap, std::false_type>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_swap, std::false_type>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<C<char> >::propagate_on_container_swap, std::false_type>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct ReboundA {};
|
struct ReboundA {};
|
||||||
|
|
||||||
|
@ -61,19 +63,39 @@ struct E
|
||||||
template <class U> struct rebind {typedef ReboundA<U> otter;};
|
template <class U> struct rebind {typedef ReboundA<U> otter;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct F {
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
template <class>
|
||||||
|
struct rebind { typedef void other; };
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct G {
|
||||||
|
typedef T value_type;
|
||||||
|
template <class>
|
||||||
|
struct rebind {
|
||||||
|
private:
|
||||||
|
typedef void other;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#if TEST_STD_VER >= 11
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>, ReboundA<double> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>, ReboundB<double, char> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>, C<double> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>, D<double, char> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>, E<double> >::value), "");
|
||||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
static_assert((std::is_same<std::allocator_traits<F<char> >::rebind_alloc<double>, F<double> >::value), "");
|
||||||
|
static_assert((std::is_same<std::allocator_traits<G<char> >::rebind_alloc<double>, G<double> >::value), "");
|
||||||
|
#else
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_alloc<double>::other, ReboundA<double> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_alloc<double>::other, ReboundB<double, char> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_alloc<double>::other, C<double> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_alloc<double>::other, D<double, char> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_alloc<double>::other, E<double> >::value), "");
|
||||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -42,6 +44,14 @@ struct C
|
||||||
struct const_void_pointer {};
|
struct const_void_pointer {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct D {
|
||||||
|
typedef T value_type;
|
||||||
|
typedef short difference_type;
|
||||||
|
private:
|
||||||
|
typedef void size_type;
|
||||||
|
};
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -60,4 +70,7 @@ int main()
|
||||||
std::make_unsigned<std::ptrdiff_t>::type>::value), "");
|
std::make_unsigned<std::ptrdiff_t>::type>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::size_type,
|
static_assert((std::is_same<std::allocator_traits<C<char> >::size_type,
|
||||||
unsigned char>::value), "");
|
unsigned char>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<D<char> >::size_type, unsigned short>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Ptr {};
|
struct Ptr {};
|
||||||
|
@ -47,9 +48,21 @@ struct C
|
||||||
typedef CPtr<void> void_pointer;
|
typedef CPtr<void> void_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct D
|
||||||
|
{
|
||||||
|
typedef T value_type;
|
||||||
|
private:
|
||||||
|
typedef void void_pointer;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::allocator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<A<char> >::void_pointer, Ptr<void> >::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
|
static_assert((std::is_same<std::allocator_traits<B<char> >::void_pointer, void*>::value), "");
|
||||||
static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
|
static_assert((std::is_same<std::allocator_traits<C<char> >::void_pointer, CPtr<void> >::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::allocator_traits<D<char> >::void_pointer, void*>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@ -23,6 +25,19 @@ struct B
|
||||||
typedef int allocator_type;
|
typedef int allocator_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct C {
|
||||||
|
static int allocator_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct D {
|
||||||
|
static int allocator_type() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct E {
|
||||||
|
private:
|
||||||
|
typedef int allocator_type;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
|
static_assert((!std::uses_allocator<int, std::allocator<int> >::value), "");
|
||||||
|
@ -30,4 +45,9 @@ int main()
|
||||||
static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
|
static_assert((!std::uses_allocator<A, std::allocator<int> >::value), "");
|
||||||
static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
|
static_assert((!std::uses_allocator<B, std::allocator<int> >::value), "");
|
||||||
static_assert(( std::uses_allocator<B, double>::value), "");
|
static_assert(( std::uses_allocator<B, double>::value), "");
|
||||||
|
static_assert((!std::uses_allocator<C, decltype(C::allocator_type)>::value), "");
|
||||||
|
static_assert((!std::uses_allocator<D, decltype(D::allocator_type)>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((!std::uses_allocator<E, int>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
typedef short element_type;
|
typedef short element_type;
|
||||||
|
@ -39,10 +41,26 @@ struct D
|
||||||
typedef char difference_type;
|
typedef char difference_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct E
|
||||||
|
{
|
||||||
|
static int difference_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct F {
|
||||||
|
private:
|
||||||
|
typedef int difference_type;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
|
static_assert((std::is_same<std::pointer_traits<A>::difference_type, char>::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
|
static_assert((std::is_same<std::pointer_traits<B>::difference_type, std::ptrdiff_t>::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
|
static_assert((std::is_same<std::pointer_traits<C<double> >::difference_type, std::ptrdiff_t>::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
|
static_assert((std::is_same<std::pointer_traits<D<int> >::difference_type, char>::value), "");
|
||||||
|
static_assert((std::is_same<std::pointer_traits<E<int> >::difference_type, std::ptrdiff_t>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::pointer_traits<F<int>>::difference_type, std::ptrdiff_t>::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,27 @@ struct D
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
struct E
|
||||||
|
{
|
||||||
|
static int element_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct F {
|
||||||
|
private:
|
||||||
|
typedef int element_type;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
|
static_assert((std::is_same<std::pointer_traits<A>::element_type, char>::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
|
static_assert((std::is_same<std::pointer_traits<B<int> >::element_type, char>::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<C<int> >::element_type, int>::value), "");
|
static_assert((std::is_same<std::pointer_traits<C<int> >::element_type, int>::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
|
static_assert((std::is_same<std::pointer_traits<D<double, int> >::element_type, double>::value), "");
|
||||||
|
static_assert((std::is_same<std::pointer_traits<E<double, int> >::element_type, double>::value), "");
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
static_assert((std::is_same<std::pointer_traits<F<double>>::element_type, double>::value), "");
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -29,7 +31,7 @@ template <class T> struct B1 {};
|
||||||
template <class T>
|
template <class T>
|
||||||
struct B
|
struct B
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#if TEST_STD_VER >= 11
|
||||||
template <class U> using rebind = B1<U>;
|
template <class U> using rebind = B1<U>;
|
||||||
#else
|
#else
|
||||||
template <class U> struct rebind {typedef B1<U> other;};
|
template <class U> struct rebind {typedef B1<U> other;};
|
||||||
|
@ -46,24 +48,58 @@ template <class T, class U> struct D1 {};
|
||||||
template <class T, class U>
|
template <class T, class U>
|
||||||
struct D
|
struct D
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#if TEST_STD_VER >= 11
|
||||||
template <class V> using rebind = D1<V, U>;
|
template <class V> using rebind = D1<V, U>;
|
||||||
#else
|
#else
|
||||||
template <class V> struct rebind {typedef D1<V, U> other;};
|
template <class V> struct rebind {typedef D1<V, U> other;};
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
struct E
|
||||||
|
{
|
||||||
|
template <class>
|
||||||
|
void rebind() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
template <class T, class U>
|
||||||
|
struct F {
|
||||||
|
private:
|
||||||
|
template <class>
|
||||||
|
using rebind = void;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TEST_STD_VER >= 14
|
||||||
|
template <class T, class U>
|
||||||
|
struct G
|
||||||
|
{
|
||||||
|
template <class>
|
||||||
|
static constexpr int rebind = 42;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#if TEST_STD_VER >= 11
|
||||||
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>, A<double*> >::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>, B1<double> >::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>, C<double, int> >::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>, D1<double, int> >::value), "");
|
||||||
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
static_assert((std::is_same<std::pointer_traits<E<char, int> >::rebind<double>, E<double, int> >::value), "");
|
||||||
|
static_assert((std::is_same<std::pointer_traits<F<char, int> >::rebind<double>, F<double, int> >::value), "");
|
||||||
|
|
||||||
|
#if TEST_STD_VER >= 14
|
||||||
|
static_assert((std::is_same<std::pointer_traits<G<char, int> >::rebind<double>, G<double, int> >::value), "");
|
||||||
|
#endif
|
||||||
|
#else // TEST_STD_VER < 11
|
||||||
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<A<int*> >::rebind<double*>::other, A<double*> >::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<B<int> >::rebind<double>::other, B1<double> >::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<C<char, int> >::rebind<double>::other, C<double, int> >::value), "");
|
||||||
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
|
static_assert((std::is_same<std::pointer_traits<D<char, int> >::rebind<double>::other, D1<double, int> >::value), "");
|
||||||
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
static_assert((std::is_same<std::pointer_traits<E<char, int> >::rebind<double>::other, E<double, int> >::value), "");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,11 +16,22 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
struct Deleter
|
struct Deleter
|
||||||
{
|
{
|
||||||
struct pointer {};
|
struct pointer {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct D2 {
|
||||||
|
private:
|
||||||
|
typedef void pointer;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct D3 {
|
||||||
|
static long pointer;
|
||||||
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -31,4 +42,14 @@ int main()
|
||||||
typedef std::unique_ptr<int, Deleter> P;
|
typedef std::unique_ptr<int, Deleter> P;
|
||||||
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
|
static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
|
||||||
}
|
}
|
||||||
|
#if TEST_STD_VER >= 11
|
||||||
|
{
|
||||||
|
typedef std::unique_ptr<int, D2> P;
|
||||||
|
static_assert(std::is_same<P::pointer, int*>::value, "");
|
||||||
|
|
||||||
|
{
|
||||||
|
typedef std::unique_ptr<int, D3> P;
|
||||||
|
static_assert(std::is_same<P::pointer, int*>::value, "");
|
||||||
|
}}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2233">2233</td><td><code>bad_function_call::what()</code> unhelpful</td><td>Urbana</td><td>Complete</td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2233">2233</td><td><code>bad_function_call::what()</code> unhelpful</td><td>Urbana</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2266">2266</td><td><code>vector</code> and <code>deque</code> have incorrect insert requirements</td><td>Urbana</td><td>Complete</td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2266">2266</td><td><code>vector</code> and <code>deque</code> have incorrect insert requirements</td><td>Urbana</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2325">2325</td><td><code>minmax_element()</code>'s behavior differing from <code>max_element()</code>'s should be noted</td><td>Urbana</td><td>Complete</td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2325">2325</td><td><code>minmax_element()</code>'s behavior differing from <code>max_element()</code>'s should be noted</td><td>Urbana</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2361">2361</td><td>Apply 2299 resolution throughout library</td><td>Urbana</td><td></td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2361">2361</td><td>Apply 2299 resolution throughout library</td><td>Urbana</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2365">2365</td><td>Missing noexcept in <code>shared_ptr::shared_ptr(nullptr_t)</code></td><td>Urbana</td><td>Complete</td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2365">2365</td><td>Missing noexcept in <code>shared_ptr::shared_ptr(nullptr_t)</code></td><td>Urbana</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2376">2376</td><td><code>bad_weak_ptr::what()</code> overspecified</td><td>Urbana</td><td>Complete</td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2376">2376</td><td><code>bad_weak_ptr::what()</code> overspecified</td><td>Urbana</td><td>Complete</td></tr>
|
||||||
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2387">2387</td><td>More nested types that must be accessible and unambiguous</td><td>Urbana</td><td>Complete</td></tr>
|
<tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2387">2387</td><td>More nested types that must be accessible and unambiguous</td><td>Urbana</td><td>Complete</td></tr>
|
||||||
|
|
Loading…
Reference in New Issue