#if !defined(phmap_base_h_guard_) #define phmap_base_h_guard_ // --------------------------------------------------------------------------- // Copyright (c) 2019, Gregory Popovitch - greg7mdp@gmail.com // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Includes work from abseil-cpp (https://github.com/abseil/abseil-cpp) // with modifications. // // Copyright 2018 The Abseil Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // --------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include #include #include #include #include // for std::lock #include "phmap_config.h" #ifdef PHMAP_HAVE_SHARED_MUTEX #include // after "phmap_config.h" #endif #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4514) // unreferenced inline function has been removed #pragma warning(disable : 4582) // constructor is not implicitly called #pragma warning(disable : 4625) // copy constructor was implicitly defined as deleted #pragma warning(disable : 4626) // assignment operator was implicitly defined as deleted #pragma warning(disable : 4710) // function not inlined #pragma warning(disable : 4711) // selected for automatic inline expansion #pragma warning(disable : 4820) // '6' bytes padding added after data member #endif // _MSC_VER namespace phmap { template using Allocator = typename std::allocator; template using Pair = typename std::pair; template struct EqualTo { inline bool operator()(const T& a, const T& b) const { return std::equal_to()(a, b); } }; template struct Less { inline bool operator()(const T& a, const T& b) const { return std::less()(a, b); } }; namespace type_traits_internal { template struct VoidTImpl { using type = void; }; // This trick to retrieve a default alignment is necessary for our // implementation of aligned_storage_t to be consistent with any implementation // of std::aligned_storage. // --------------------------------------------------------------------------- template > struct default_alignment_of_aligned_storage; template struct default_alignment_of_aligned_storage> { static constexpr size_t value = Align; }; // NOTE: The `is_detected` family of templates here differ from the library // fundamentals specification in that for library fundamentals, `Op` is // evaluated as soon as the type `is_detected` undergoes // substitution, regardless of whether or not the `::value` is accessed. That // is inconsistent with all other standard traits and prevents lazy evaluation // in larger contexts (such as if the `is_detected` check is a trailing argument // of a `conjunction`. This implementation opts to instead be lazy in the same // way that the standard traits are (this "defect" of the detection idiom // specifications has been reported). // --------------------------------------------------------------------------- template class Op, class... Args> struct is_detected_impl { using type = std::false_type; }; template