.. SPDX-FileCopyrightText: 2019-2021 Intel Corporation .. .. SPDX-License-Identifier: CC-BY-4.0 ================ Deduction guides ================ If possible, ``concurrent_hash_map`` constructors support class template argument deduction (since C++17). Copy and move constructors, including constructors with an explicit ``allocator_type`` argument, provide implicitly-generated deduction guides. In addition, the following explicit deduction guides are provided: .. code:: cpp template >, typename Allocator = tbb_allocator>> concurrent_hash_map( InputIterator, InputIterator, HashCompare = HashCompare(), Allocator = Allocator() ) -> concurrent_hash_map, iterator_mapped_t, HashCompare, Allocator>; template concurrent_hash_map( InputIterator, InputIterator, Allocator ) -> concurrent_hash_map, iterator_mapped_t, tbb_hash_compare>, Allocator>; template >, typename Allocator = tbb_allocator>> concurrent_hash_map( std::initializer_list>, HashCompare = HashCompare(), Allocator = Allocator() ) -> concurrent_hash_map, T, HashCompare, Allocator>; template concurrent_hash_map( std::initializer_list>, Allocator ) -> concurrent_hash_map, T, tbb_hash_compare>, Allocator>; Where the type aliases ``iterator_key_t``, ``iterator_mapped_t``, and ``iterator_alloc_value_t`` are defined as follows: .. code:: cpp template using iterator_key_t = std::remove_const_t::value_type::first_type>; template using iterator_mapped_t = typename std::iterator_traits::value_type::second_type; template using iterator_alloc_value_t = std::pair, iterator_mapped_t>>; These deduction guides only participate in the overload resolution if the following requirements are met: * The ``InputIterator`` type meets the ``InputIterator`` requirements described in the [input.iterators] section of the ISO C++ Standard. * The ``Allocator`` type meets the ``Allocator`` requirements described in the [allocator.requirements] section of the ISO C++ Standard. * The ``HashCompare`` type does not meet the ``Allocator`` requirements. **Example** .. code:: cpp #include #include int main() { std::vector> v; // Deduces chmap1 as oneapi::tbb::concurrent_hash_map oneapi::tbb::concurrent_hash_map chmap1(v.begin(), v.end()); std::allocator> alloc; // Deduces chmap2 as oneapi::tbb::concurrent_hash_map, // std::allocator>> oneapi::tbb::concurrent_hash_map chmap2(v.begin(), v.end(), alloc); }