/* Copyright 2018 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #include template class A { public: typedef T value_type; typedef T* pointer; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; template struct rebind { typedef A other; }; A(int state) : state_(state) { } template A(const A& other) : state_(other.state()) { } T* allocate(std::size_t size, const void* = 0) { return static_cast(::operator new(sizeof(T) * size)); } void deallocate(T* ptr, std::size_t) { ::operator delete(ptr); } int state() const { return state_; } private: int state_; }; template inline bool operator==(const A& a, const A& b) { return a.state() == b.state(); } template inline bool operator!=(const A& a, const A& b) { return !(a == b); } struct S; struct V { }; void value_test() { boost::alignment::aligned_allocator_adaptor > a(A(1)); (void)a; } void rebind_test() { boost::alignment::aligned_allocator_adaptor > a(A(1)); boost::alignment::aligned_allocator_adaptor >::rebind::other r(a); (void)r; }