diff --git a/doc/container.qbk b/doc/container.qbk index 71bb14e..64cc808 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1320,6 +1320,7 @@ use [*Boost.Container]? There are several reasons for that: [section:release_notes_boost_1_74_00 Boost 1.74 Release] * Fixed bugs/issues: + * [@https://github.com/boostorg/container/issues/125 GitHub #125: ['"flat_map doc misleading complexity"]]. * [@https://github.com/boostorg/container/issues/126 GitHub #126: ['"flat_set.hpp and set.hpp in pmr have the same header guard"]]. * [@https://github.com/boostorg/container/issues/128 GitHub #128: ['"moved from small_vector and static_vector calls destructor on elements in static part"]]. * [@https://github.com/boostorg/container/issues/129 GitHub #129: ['"Alias templates for small_flat_[multi]{set|map} using small_vector as container"]]. diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 63e7ab1..88b32c0 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -713,7 +713,7 @@ class flat_map //! //! Returns: A reference to the mapped_type corresponding to x in *this. //! - //! Complexity: Logarithmic. + //! Complexity: Logarithmic search time plus linear insertion time in case no equivalent key is present. mapped_type &operator[](const key_type& k); //! Effects: If there is no key equivalent to x in the flat_map, inserts @@ -721,8 +721,8 @@ class flat_map //! //! Returns: A reference to the mapped_type corresponding to x in *this. //! - //! Complexity: Logarithmic. - mapped_type &operator[](key_type &&k) ; + //! Complexity: Logarithmic search time plus linear insertion time in case no equivalent key is present. + mapped_type &operator[](key_type &&k); #elif defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN) //in compilers like GCC 3.4, we can't catch temporaries BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); } @@ -742,7 +742,7 @@ class flat_map //! Returns: The bool component is true if the insertion took place and false if the assignment //! took place. The iterator component is pointing at the element that was inserted or updated. //! - //! Complexity: Logarithmic in the size of the container. + //! Complexity: Logarithmic search time plus linear insertion time in case no equivalent key is present. template BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj) { @@ -955,7 +955,7 @@ class flat_map //! Returns: The bool component of the returned pair is true if and only if the //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. //! - //! Complexity: Logarithmic. + //! Complexity: Logarithmic search time plus linear insertion time in case the key is not present. template BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) { @@ -973,7 +973,7 @@ class flat_map //! Returns: The returned iterator points to the map element whose key is equivalent to k. //! //! Complexity: Logarithmic in general, but amortized constant if value - //! is inserted right before p. + //! is inserted right before p. Linear insertion time in case no equivalent key is present. template BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) {