diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..3ecfb3f0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space + +[*.?pp] +indent_size = 2 diff --git a/_clang-format b/_clang-format index 5ca4ced9..b1522cf4 100644 --- a/_clang-format +++ b/_clang-format @@ -11,8 +11,9 @@ BasedOnStyle: LLVM # Basic settings ColumnLimit: 80 -ContinuationIndentWidth: 4 -IndentWidth: 4 +NamespaceIndentation: All +ContinuationIndentWidth: 2 +IndentWidth: 2 UseTab: Never Language: Cpp Standard: Cpp03 diff --git a/include/boost/unordered/detail/fwd.hpp b/include/boost/unordered/detail/fwd.hpp index 2e0c6307..7f25cfc1 100644 --- a/include/boost/unordered/detail/fwd.hpp +++ b/include/boost/unordered/detail/fwd.hpp @@ -43,17 +43,17 @@ #endif namespace boost { -namespace unordered { + namespace unordered { #if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT -using std::piecewise_construct_t; -using std::piecewise_construct; + using std::piecewise_construct_t; + using std::piecewise_construct; #else -struct piecewise_construct_t -{ -}; -const piecewise_construct_t piecewise_construct = piecewise_construct_t(); + struct piecewise_construct_t + { + }; + const piecewise_construct_t piecewise_construct = piecewise_construct_t(); #endif -} + } } #endif diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 5750a4c6..5b6b23d3 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -144,7 +144,7 @@ // Otherwise allocators aren't used for construction/destruction #if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT && \ - !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && BOOST_UNORDERED_TUPLE_ARGS + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && BOOST_UNORDERED_TUPLE_ARGS #if BOOST_COMP_SUNPRO && BOOST_LIB_STD_GNU // Sun C++ std::pair piecewise construction doesn't seem to be exception safe. // (At least for Sun C++ 12.5 using libstdc++). @@ -153,7 +153,7 @@ // Piecewise construction in GCC 4.6 doesn't work for uncopyable types. #define BOOST_UNORDERED_CXX11_CONSTRUCTION 0 #elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 0 && \ - !defined(BOOST_NO_SFINAE_EXPR) + !defined(BOOST_NO_SFINAE_EXPR) #define BOOST_UNORDERED_CXX11_CONSTRUCTION 1 #elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 #define BOOST_UNORDERED_CXX11_CONSTRUCTION 1 @@ -177,7 +177,7 @@ // Wrapper around various depreaction attributes. #if defined(__has_cpp_attribute) && \ - (!defined(__cplusplus) || __cplusplus >= 201402) + (!defined(__cplusplus) || __cplusplus >= 201402) #if __has_cpp_attribute(deprecated) && !defined(BOOST_UNORDERED_DEPRECATED) #define BOOST_UNORDERED_DEPRECATED(msg) [[deprecated(msg)]] #endif @@ -196,71 +196,73 @@ #endif namespace boost { -namespace unordered { -namespace iterator_detail { -template struct iterator; -template struct c_iterator; -template struct l_iterator; -template struct cl_iterator; -} -} + namespace unordered { + namespace iterator_detail { + template struct iterator; + template struct c_iterator; + template struct l_iterator; + template struct cl_iterator; + } + } } namespace boost { -namespace unordered { -namespace detail { + namespace unordered { + namespace detail { -template struct table; -template struct bucket; -struct ptr_bucket; + template struct table; + template struct bucket; + struct ptr_bucket; -template struct node; -template struct ptr_node; + template struct node; + template struct ptr_node; -static const float minimum_max_load_factor = 1e-3f; -static const std::size_t default_bucket_count = 11; + static const float minimum_max_load_factor = 1e-3f; + static const std::size_t default_bucket_count = 11; -struct move_tag -{ -}; + struct move_tag + { + }; -struct empty_emplace -{ -}; + struct empty_emplace + { + }; -struct no_key -{ - no_key() {} - template no_key(T const&) {} -}; + struct no_key + { + no_key() {} + template no_key(T const&) {} + }; -namespace func { -template inline void ignore_unused_variable_warning(T const&) {} -} + namespace func { + template inline void ignore_unused_variable_warning(T const&) + { + } + } -//////////////////////////////////////////////////////////////////////////// -// iterator SFINAE + //////////////////////////////////////////////////////////////////////////// + // iterator SFINAE -template -struct is_forward - : boost::is_convertible::type, - boost::forward_traversal_tag> -{ -}; + template + struct is_forward + : boost::is_convertible::type, + boost::forward_traversal_tag> + { + }; -template -struct enable_if_forward - : boost::enable_if_c::value, - ReturnType> -{ -}; + template + struct enable_if_forward + : boost::enable_if_c::value, + ReturnType> + { + }; -template -struct disable_if_forward - : boost::disable_if_c::value, - ReturnType> -{ -}; + template + struct disable_if_forward + : boost::disable_if_c::value, + ReturnType> + { + }; //////////////////////////////////////////////////////////////////////////// // primes @@ -274,194 +276,198 @@ struct disable_if_forward (1572869ul)(3145739ul)(6291469ul)(12582917ul)(25165843ul) \ (50331653ul)(100663319ul)(201326611ul)(402653189ul)(805306457ul) \ (1610612741ul)(3221225473ul)(4294967291ul) -// clang-format on + // clang-format on -template struct prime_list_template -{ - static std::size_t const value[]; + template struct prime_list_template + { + static std::size_t const value[]; #if !BOOST_UNORDERED_SUN_WORKAROUNDS1 - static std::ptrdiff_t const length; + static std::ptrdiff_t const length; #else - static std::ptrdiff_t const length = - BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES); + static std::ptrdiff_t const length = + BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES); #endif -}; + }; -template -std::size_t const prime_list_template::value[] = { - BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES)}; + template + std::size_t const prime_list_template::value[] = { + BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES)}; #if !BOOST_UNORDERED_SUN_WORKAROUNDS1 -template -std::ptrdiff_t const prime_list_template::length = BOOST_PP_SEQ_SIZE( - BOOST_UNORDERED_PRIMES); + template + std::ptrdiff_t const prime_list_template::length = BOOST_PP_SEQ_SIZE( + BOOST_UNORDERED_PRIMES); #endif #undef BOOST_UNORDERED_PRIMES -typedef prime_list_template prime_list; + typedef prime_list_template prime_list; -// no throw -inline std::size_t next_prime(std::size_t num) -{ - std::size_t const* const prime_list_begin = prime_list::value; - std::size_t const* const prime_list_end = - prime_list_begin + prime_list::length; - std::size_t const* bound = - std::lower_bound(prime_list_begin, prime_list_end, num); - if (bound == prime_list_end) - bound--; - return *bound; -} + // no throw + inline std::size_t next_prime(std::size_t num) + { + std::size_t const* const prime_list_begin = prime_list::value; + std::size_t const* const prime_list_end = + prime_list_begin + prime_list::length; + std::size_t const* bound = + std::lower_bound(prime_list_begin, prime_list_end, num); + if (bound == prime_list_end) + bound--; + return *bound; + } -// no throw -inline std::size_t prev_prime(std::size_t num) -{ - std::size_t const* const prime_list_begin = prime_list::value; - std::size_t const* const prime_list_end = - prime_list_begin + prime_list::length; - std::size_t const* bound = - std::upper_bound(prime_list_begin, prime_list_end, num); - if (bound != prime_list_begin) - bound--; - return *bound; -} + // no throw + inline std::size_t prev_prime(std::size_t num) + { + std::size_t const* const prime_list_begin = prime_list::value; + std::size_t const* const prime_list_end = + prime_list_begin + prime_list::length; + std::size_t const* bound = + std::upper_bound(prime_list_begin, prime_list_end, num); + if (bound != prime_list_begin) + bound--; + return *bound; + } -//////////////////////////////////////////////////////////////////////////// -// insert_size/initial_size + //////////////////////////////////////////////////////////////////////////// + // insert_size/initial_size -template -inline std::size_t insert_size(I i, I j, - typename boost::unordered::detail::enable_if_forward::type = 0) -{ - return static_cast(std::distance(i, j)); -} + template + inline std::size_t insert_size(I i, I j, + typename boost::unordered::detail::enable_if_forward::type = + 0) + { + return static_cast(std::distance(i, j)); + } -template -inline std::size_t insert_size(I, I, - typename boost::unordered::detail::disable_if_forward::type = 0) -{ - return 1; -} + template + inline std::size_t insert_size(I, I, + typename boost::unordered::detail::disable_if_forward::type = + 0) + { + return 1; + } -template -inline std::size_t initial_size(I i, I j, - std::size_t num_buckets = boost::unordered::detail::default_bucket_count) -{ - // TODO: Why +1? - return (std::max)( - boost::unordered::detail::insert_size(i, j) + 1, num_buckets); -} + template + inline std::size_t initial_size( + I i, I j, std::size_t num_buckets = + boost::unordered::detail::default_bucket_count) + { + // TODO: Why +1? + return (std::max)( + boost::unordered::detail::insert_size(i, j) + 1, num_buckets); + } -//////////////////////////////////////////////////////////////////////////// -// compressed + //////////////////////////////////////////////////////////////////////////// + // compressed -template struct compressed_base : private T -{ - compressed_base(T const& x) : T(x) {} - compressed_base(T& x, move_tag) : T(boost::move(x)) {} + template struct compressed_base : private T + { + compressed_base(T const& x) : T(x) {} + compressed_base(T& x, move_tag) : T(boost::move(x)) {} - T& get() { return *this; } - T const& get() const { return *this; } -}; + T& get() { return *this; } + T const& get() const { return *this; } + }; -template struct uncompressed_base -{ - uncompressed_base(T const& x) : value_(x) {} - uncompressed_base(T& x, move_tag) : value_(boost::move(x)) {} + template struct uncompressed_base + { + uncompressed_base(T const& x) : value_(x) {} + uncompressed_base(T& x, move_tag) : value_(boost::move(x)) {} - T& get() { return value_; } - T const& get() const { return value_; } - private: - T value_; -}; + T& get() { return value_; } + T const& get() const { return value_; } + private: + T value_; + }; -template -struct generate_base - : boost::detail::if_true::value>::BOOST_NESTED_TEMPLATE - then, + template + struct generate_base + : boost::detail::if_true< + boost::is_empty::value>::BOOST_NESTED_TEMPLATE + then, boost::unordered::detail::uncompressed_base > -{ -}; + { + }; -template -struct compressed - : private boost::unordered::detail::generate_base::type, - private boost::unordered::detail::generate_base::type -{ - typedef typename generate_base::type base1; - typedef typename generate_base::type base2; + template + struct compressed + : private boost::unordered::detail::generate_base::type, + private boost::unordered::detail::generate_base::type + { + typedef typename generate_base::type base1; + typedef typename generate_base::type base2; - typedef T1 first_type; - typedef T2 second_type; + typedef T1 first_type; + typedef T2 second_type; - first_type& first() { return static_cast(this)->get(); } + first_type& first() { return static_cast(this)->get(); } - first_type const& first() const - { - return static_cast(this)->get(); - } + first_type const& first() const + { + return static_cast(this)->get(); + } - second_type& second() { return static_cast(this)->get(); } + second_type& second() { return static_cast(this)->get(); } - second_type const& second() const - { - return static_cast(this)->get(); - } + second_type const& second() const + { + return static_cast(this)->get(); + } - template - compressed(First const& x1, Second const& x2) : base1(x1), base2(x2) - { - } + template + compressed(First const& x1, Second const& x2) : base1(x1), base2(x2) + { + } - compressed(compressed const& x) : base1(x.first()), base2(x.second()) {} + compressed(compressed const& x) : base1(x.first()), base2(x.second()) {} - compressed(compressed& x, move_tag m) - : base1(x.first(), m), base2(x.second(), m) - { - } + compressed(compressed& x, move_tag m) + : base1(x.first(), m), base2(x.second(), m) + { + } - void assign(compressed const& x) - { - first() = x.first(); - second() = x.second(); - } + void assign(compressed const& x) + { + first() = x.first(); + second() = x.second(); + } - void move_assign(compressed& x) - { - first() = boost::move(x.first()); - second() = boost::move(x.second()); - } + void move_assign(compressed& x) + { + first() = boost::move(x.first()); + second() = boost::move(x.second()); + } - void swap(compressed& x) - { - boost::swap(first(), x.first()); - boost::swap(second(), x.second()); - } + void swap(compressed& x) + { + boost::swap(first(), x.first()); + boost::swap(second(), x.second()); + } - private: - // Prevent assignment just to make use of assign or - // move_assign explicit. - compressed& operator=(compressed const&); -}; + private: + // Prevent assignment just to make use of assign or + // move_assign explicit. + compressed& operator=(compressed const&); + }; -//////////////////////////////////////////////////////////////////////////// -// pair_traits -// -// Used to get the types from a pair without instantiating it. + //////////////////////////////////////////////////////////////////////////// + // pair_traits + // + // Used to get the types from a pair without instantiating it. -template struct pair_traits -{ - typedef typename Pair::first_type first_type; - typedef typename Pair::second_type second_type; -}; + template struct pair_traits + { + typedef typename Pair::first_type first_type; + typedef typename Pair::second_type second_type; + }; -template struct pair_traits > -{ - typedef T1 first_type; - typedef T2 second_type; -}; + template struct pair_traits > + { + typedef T1 first_type; + typedef T2 second_type; + }; #if defined(BOOST_MSVC) #pragma warning(push) @@ -471,75 +477,79 @@ template struct pair_traits > // will be default-initialized. #endif -//////////////////////////////////////////////////////////////////////////// -// Bits and pieces for implementing traits + //////////////////////////////////////////////////////////////////////////// + // Bits and pieces for implementing traits -template typename boost::add_lvalue_reference::type make(); -struct choice9 -{ - typedef char (&type)[9]; -}; -struct choice8 : choice9 -{ - typedef char (&type)[8]; -}; -struct choice7 : choice8 -{ - typedef char (&type)[7]; -}; -struct choice6 : choice7 -{ - typedef char (&type)[6]; -}; -struct choice5 : choice6 -{ - typedef char (&type)[5]; -}; -struct choice4 : choice5 -{ - typedef char (&type)[4]; -}; -struct choice3 : choice4 -{ - typedef char (&type)[3]; -}; -struct choice2 : choice3 -{ - typedef char (&type)[2]; -}; -struct choice1 : choice2 -{ - typedef char (&type)[1]; -}; -choice1 choose(); + template + typename boost::add_lvalue_reference::type make(); + struct choice9 + { + typedef char (&type)[9]; + }; + struct choice8 : choice9 + { + typedef char (&type)[8]; + }; + struct choice7 : choice8 + { + typedef char (&type)[7]; + }; + struct choice6 : choice7 + { + typedef char (&type)[6]; + }; + struct choice5 : choice6 + { + typedef char (&type)[5]; + }; + struct choice4 : choice5 + { + typedef char (&type)[4]; + }; + struct choice3 : choice4 + { + typedef char (&type)[3]; + }; + struct choice2 : choice3 + { + typedef char (&type)[2]; + }; + struct choice1 : choice2 + { + typedef char (&type)[1]; + }; + choice1 choose(); -typedef choice1::type yes_type; -typedef choice2::type no_type; + typedef choice1::type yes_type; + typedef choice2::type no_type; -struct private_type -{ - private_type const& operator,(int) const; -}; + struct private_type + { + private_type const& operator,(int) const; + }; -template no_type is_private_type(T const&); -yes_type is_private_type(private_type const&); + template no_type is_private_type(T const&); + yes_type is_private_type(private_type const&); -struct convert_from_anything -{ - template convert_from_anything(T const&); -}; + struct convert_from_anything + { + template convert_from_anything(T const&); + }; -// Get a pointer from a smart pointer, a bit simpler than pointer_traits -// as we already know the pointer type that we want. -template struct pointer -{ - template static T* get(Ptr const& x) - { - return static_cast(x.operator->()); - } + // Get a pointer from a smart pointer, a bit simpler than pointer_traits + // as we already know the pointer type that we want. + template struct pointer + { + template static T* get(Ptr const& x) + { + return static_cast(x.operator->()); + } - template static T* get(T2* x) { return static_cast(x); } -}; + template static T* get(T2* x) + { + return static_cast(x); + } + }; //////////////////////////////////////////////////////////////////////////// // emplace_args @@ -562,104 +572,102 @@ template struct pointer #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) #define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ - typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, n); \ - BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); + typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, n); \ + BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); #else #define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ - typedef typename boost::add_lvalue_reference::type \ - BOOST_PP_CAT(Arg, n); \ - BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); + typedef typename boost::add_lvalue_reference::type \ + BOOST_PP_CAT(Arg, n); \ + BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); #endif -template -struct emplace_args1 -{ - BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) + template struct emplace_args1 + { + BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) - explicit emplace_args1(Arg0 b0) : a0(b0) {} -}; + explicit emplace_args1(Arg0 b0) : a0(b0) {} + }; -template -inline emplace_args1 create_emplace_args(BOOST_FWD_REF(A0) b0) -{ - emplace_args1 e(b0); - return e; -} + template + inline emplace_args1 create_emplace_args(BOOST_FWD_REF(A0) b0) + { + emplace_args1 e(b0); + return e; + } -template struct emplace_args2 -{ - BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) - BOOST_UNORDERED_EARGS_MEMBER(1, 1, _) + template struct emplace_args2 + { + BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) + BOOST_UNORDERED_EARGS_MEMBER(1, 1, _) - emplace_args2(Arg0 b0, Arg1 b1) : a0(b0), a1(b1) {} -}; + emplace_args2(Arg0 b0, Arg1 b1) : a0(b0), a1(b1) {} + }; -template -inline emplace_args2 create_emplace_args( - BOOST_FWD_REF(A0) b0, BOOST_FWD_REF(A1) b1) -{ - emplace_args2 e(b0, b1); - return e; -} + template + inline emplace_args2 create_emplace_args( + BOOST_FWD_REF(A0) b0, BOOST_FWD_REF(A1) b1) + { + emplace_args2 e(b0, b1); + return e; + } -template struct emplace_args3 -{ - BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) - BOOST_UNORDERED_EARGS_MEMBER(1, 1, _) - BOOST_UNORDERED_EARGS_MEMBER(1, 2, _) + template struct emplace_args3 + { + BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) + BOOST_UNORDERED_EARGS_MEMBER(1, 1, _) + BOOST_UNORDERED_EARGS_MEMBER(1, 2, _) - emplace_args3(Arg0 b0, Arg1 b1, Arg2 b2) : a0(b0), a1(b1), a2(b2) {} -}; + emplace_args3(Arg0 b0, Arg1 b1, Arg2 b2) : a0(b0), a1(b1), a2(b2) {} + }; -template -inline emplace_args3 create_emplace_args( - BOOST_FWD_REF(A0) b0, BOOST_FWD_REF(A1) b1, BOOST_FWD_REF(A2) b2) -{ - emplace_args3 e(b0, b1, b2); - return e; -} + template + inline emplace_args3 create_emplace_args( + BOOST_FWD_REF(A0) b0, BOOST_FWD_REF(A1) b1, BOOST_FWD_REF(A2) b2) + { + emplace_args3 e(b0, b1, b2); + return e; + } #define BOOST_UNORDERED_FWD_PARAM(z, n, a) \ - BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(a, n) + BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(a, n) #define BOOST_UNORDERED_CALL_FORWARD(z, i, a) \ - boost::forward(BOOST_PP_CAT(a, i)) + boost::forward(BOOST_PP_CAT(a, i)) #define BOOST_UNORDERED_EARGS_INIT(z, n, _) \ - BOOST_PP_CAT(a, n)(BOOST_PP_CAT(b, n)) + BOOST_PP_CAT(a, n)(BOOST_PP_CAT(b, n)) #define BOOST_UNORDERED_EARGS(z, n, _) \ - template \ - struct BOOST_PP_CAT(emplace_args, n) \ + template \ + struct BOOST_PP_CAT(emplace_args, n) \ + { \ + BOOST_PP_REPEAT_##z(n, BOOST_UNORDERED_EARGS_MEMBER, _) BOOST_PP_CAT( \ + emplace_args, n)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, Arg, b)) \ + : BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_EARGS_INIT, _) \ { \ - BOOST_PP_REPEAT_##z(n, BOOST_UNORDERED_EARGS_MEMBER, _) BOOST_PP_CAT( \ - emplace_args, n)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, Arg, b)) \ - : BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_EARGS_INIT, _) \ - { \ - } \ - }; \ + } \ + }; \ \ - template \ - inline BOOST_PP_CAT(emplace_args, n) \ - create_emplace_args( \ - BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \ - { \ - BOOST_PP_CAT(emplace_args, n) e( \ - BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \ - return e; \ - } + template \ + inline BOOST_PP_CAT(emplace_args, n) \ + create_emplace_args(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \ + { \ + BOOST_PP_CAT(emplace_args, n) e( \ + BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \ + return e; \ + } -BOOST_UNORDERED_EARGS(1, 4, _) -BOOST_UNORDERED_EARGS(1, 5, _) -BOOST_UNORDERED_EARGS(1, 6, _) -BOOST_UNORDERED_EARGS(1, 7, _) -BOOST_UNORDERED_EARGS(1, 8, _) -BOOST_UNORDERED_EARGS(1, 9, _) -BOOST_PP_REPEAT_FROM_TO( - 10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), BOOST_UNORDERED_EARGS, _) + BOOST_UNORDERED_EARGS(1, 4, _) + BOOST_UNORDERED_EARGS(1, 5, _) + BOOST_UNORDERED_EARGS(1, 6, _) + BOOST_UNORDERED_EARGS(1, 7, _) + BOOST_UNORDERED_EARGS(1, 8, _) + BOOST_UNORDERED_EARGS(1, 9, _) + BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), + BOOST_UNORDERED_EARGS, _) #undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS #undef BOOST_UNORDERED_EARGS_MEMBER @@ -679,22 +687,23 @@ BOOST_PP_REPEAT_FROM_TO( #if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) -using std::integral_constant; -using std::true_type; -using std::false_type; + using std::integral_constant; + using std::true_type; + using std::false_type; #else -template struct integral_constant -{ - enum - { - value = Value - }; -}; + template struct integral_constant + { + enum + { + value = Value + }; + }; -typedef boost::unordered::detail::integral_constant true_type; -typedef boost::unordered::detail::integral_constant false_type; + typedef boost::unordered::detail::integral_constant true_type; + typedef boost::unordered::detail::integral_constant + false_type; #endif @@ -706,9 +715,9 @@ typedef boost::unordered::detail::integral_constant false_type; #pragma warning(disable : 4100) // unreferenced formal parameter #endif -namespace func { -template inline void destroy(T* x) { x->~T(); } -} + namespace func { + template inline void destroy(T* x) { x->~T(); } + } #if defined(BOOST_MSVC) #pragma warning(pop) @@ -726,94 +735,93 @@ template inline void destroy(T* x) { x->~T(); } #if !defined(BOOST_NO_SFINAE_EXPR) -template struct expr_test; -template struct expr_test : T -{ -}; + template struct expr_test; + template struct expr_test : T + { + }; #define BOOST_UNORDERED_CHECK_EXPRESSION(count, result, expression) \ - template \ - static typename boost::unordered::detail::expr_test::type \ - test(BOOST_PP_CAT(choice, count)) + template \ + static \ + typename boost::unordered::detail::expr_test::type \ + test(BOOST_PP_CAT(choice, count)) #define BOOST_UNORDERED_DEFAULT_EXPRESSION(count, result) \ - template \ - static BOOST_PP_CAT(choice, result)::type test( \ - BOOST_PP_CAT(choice, count)) + template \ + static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count)) #define BOOST_UNORDERED_HAS_FUNCTION(name, thing, args, _) \ - struct BOOST_PP_CAT(has_, name) \ - { \ - template static char for_expr_test(U const&); \ - BOOST_UNORDERED_CHECK_EXPRESSION( \ - 1, 1, boost::unordered::detail::make().name args); \ - BOOST_UNORDERED_DEFAULT_EXPRESSION(2, 2); \ + struct BOOST_PP_CAT(has_, name) \ + { \ + template static char for_expr_test(U const&); \ + BOOST_UNORDERED_CHECK_EXPRESSION( \ + 1, 1, boost::unordered::detail::make().name args); \ + BOOST_UNORDERED_DEFAULT_EXPRESSION(2, 2); \ \ - enum \ - { \ - value = sizeof(test(choose())) == sizeof(choice1::type) \ - }; \ - } + enum \ + { \ + value = sizeof(test(choose())) == sizeof(choice1::type) \ + }; \ + } #else -template struct identity -{ - typedef T type; -}; + template struct identity + { + typedef T type; + }; #define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \ \ - typedef typename boost::unordered::detail::identity::type \ - BOOST_PP_CAT(check, count); \ + typedef \ + typename boost::unordered::detail::identity::type BOOST_PP_CAT( \ + check, count); \ \ - template struct BOOST_PP_CAT(test, count) \ - { \ - typedef BOOST_PP_CAT(choice, result) type; \ - }; \ + template struct BOOST_PP_CAT(test, count) \ + { \ + typedef BOOST_PP_CAT(choice, result) type; \ + }; \ \ - template \ - static typename BOOST_PP_CAT(test, count)<&U::name>::type test( \ - BOOST_PP_CAT(choice, count)) + template \ + static typename BOOST_PP_CAT(test, count)<&U::name>::type test( \ + BOOST_PP_CAT(choice, count)) #define BOOST_UNORDERED_DEFAULT_MEMBER(count, result) \ - template \ - static BOOST_PP_CAT(choice, result)::type test( \ - BOOST_PP_CAT(choice, count)) + template \ + static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count)) #define BOOST_UNORDERED_HAS_MEMBER(name) \ - struct BOOST_PP_CAT(has_, name) \ + struct BOOST_PP_CAT(has_, name) \ + { \ + struct impl \ { \ - struct impl \ - { \ - struct base_mixin \ - { \ - int name; \ - }; \ - struct base : public T, public base_mixin \ - { \ - }; \ + struct base_mixin \ + { \ + int name; \ + }; \ + struct base : public T, public base_mixin \ + { \ + }; \ \ - BOOST_UNORDERED_CHECK_MEMBER(1, 1, name, int base_mixin::*); \ - BOOST_UNORDERED_DEFAULT_MEMBER(2, 2); \ + BOOST_UNORDERED_CHECK_MEMBER(1, 1, name, int base_mixin::*); \ + BOOST_UNORDERED_DEFAULT_MEMBER(2, 2); \ \ - enum \ - { \ - value = sizeof(choice2::type) == sizeof(test(choose())) \ - }; \ - }; \ + enum \ + { \ + value = sizeof(choice2::type) == sizeof(test(choose())) \ + }; \ + }; \ \ - enum \ - { \ - value = impl::value \ - }; \ - } + enum \ + { \ + value = impl::value \ + }; \ + } #endif -} -} + } + } } //////////////////////////////////////////////////////////////////////////////// @@ -829,415 +837,428 @@ template struct identity #include namespace boost { -namespace unordered { -namespace detail { + namespace unordered { + namespace detail { -template struct rebind_alloc; + template struct rebind_alloc; #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -template