Skip to content
Snippets Groups Projects
Commit b4aa3e86 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

override equal_range in ext set

parent fa1e08bf
No related branches found
No related tags found
1 merge request!111Merge jt
...@@ -189,6 +189,54 @@ public: ...@@ -189,6 +189,54 @@ public:
return ext::iterator_range < decltype ( endIter ) > ( beginIter, endIter ); return ext::iterator_range < decltype ( endIter ) > ( beginIter, endIter );
} }
   
/**
* \brief
* Make range of elements with key equal to the @p key.
*
* \tparam K the key used in the query
*
* \param key the value used in the query
*
* \return selected range of elements
*/
template < class K >
auto equal_range ( K && key ) const & {
auto res = std::set < T, Cmp, Alloc >::equal_range ( std::forward < K > ( key ) );
return ext::iterator_range < decltype ( res.first ) > ( res.first, res.second );
}
/**
* \brief
* Make range of elements with key equal to the @p key.
*
* \tparam K the key used in the query
*
* \param key the value used in the query
*
* \return selected range of elements
*/
template < class K >
auto equal_range ( K && key ) & {
auto res = std::set < T, Cmp, Alloc >::equal_range ( std::forward < K > ( key ) );
return ext::iterator_range < decltype ( res.first ) > ( res.first, res.second );
}
/**
* \brief
* Make range of elements with key equal to the @p key.
*
* \tparam K the key used in the query
*
* \param key the value used in the query
*
* \return selected range of elements
*/
template < class K >
auto equal_range ( K && key ) && {
auto res = std::set < T, Cmp, Alloc >::equal_range ( std::forward < K > ( key ) );
return ext::make_iterator_range ( make_set_move_iterator < T > ( res.first ), make_set_move_iterator < T > ( res.second ) );
}
/** /**
* \brief * \brief
* Test whether the set contains a given key * Test whether the set contains a given key
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment