Questions tagged [equal-range]
25 questions
0
votes
2 answers
Javascript equivalent of equal_range in C++
I'm new to Javascript, and I'm wondering if there are any existing Javascript libraries which contain binary search functionality similar to C++ equal_range? I wrote a quick implementation of what I'm looking for:
/*
* Javascript version of C++…

claytonjwong
- 814
- 1
- 7
- 13
0
votes
1 answer
I can not cout equal range
So I have this code in which I print lower, upper, and equal range but IDK how to print equal range if someone knows how I will like a coded solution to be submitted thanks
#include
using namespace std;
typedef long long…

Nothingnoname
- 1
- 1
0
votes
1 answer
C++ primer 5ed equal_range for associative containers
In C++ prime 5 Ed chapter 11. Associative containers. "Table 11.7. Operations to Find Elements in an Associative Container":
It is said: "c.equal_range(k) returns a pair of iterators denoting the elements with key k. if k is not present, both…

Itachi Uchiwa
- 3,044
- 12
- 26
0
votes
1 answer
C++ multimap with range-based for loop iterating over equal_range: error message
I am trying to iterate over an equal_range of a multimap using a range-based for loop. I'm imitating code I've seen posted, but getting an error.
#include
#include
0
votes
0 answers
Comparing std::pair<> first and last from equal_range
In the context of a map (template), for the following usage
auto begin = m_map.find(keyBegin);
auto end = m_map.find(keyEnd);
auto p = equal_range(begin,end,val);
if( !
(
p.first == p.second == m_map.end()
)
…

user9196120
- 381
- 3
- 9
0
votes
0 answers
std::equal_range() return value
According to cppreference.com
Return value
std::pair containing a pair of iterators defining the wanted range, the first pointing to the first element that is not less than value and the second pointing to the first element greater than value.
If…

user9196120
- 381
- 3
- 9
0
votes
2 answers
How can I print values of a key in sorted order in a multimap
I need to design a data structure that basically stores key-value pairs with key being an integer and its value a string.
Condition 1: There could be multiple values associated with a Key.
Condition 2: I need to print all the keys stored in this map…

Mohammed Raqeeb
- 75
- 2
- 12
0
votes
1 answer
How is equal_range supposed to work?
#include
#include
#include
int main()
{
boost::property_tree::ptree ptree;
const std::string entry = "server.url";
ptree.add( entry, "foo.com" );
auto range = ptree.equal_range(…

qdii
- 12,505
- 10
- 59
- 116
0
votes
1 answer
boost::multi_index_container - equal_range values
I have been trying a few solutions using the boost interprocess library with a map and now a multi_index_container in shared memory. With the multi_index_container, is there any way other than to iterate over the values returned from equal_range. …

Langfo
- 430
- 5
- 17
-2
votes
2 answers
std::distance is slow and how to improve it?
std::distance seems to be very slow. I have a large multimap and try to use equal_range to find the element with common key:
auto range = in_map.equal_range(neuron_with_spikes[i]);
int count = std::distance(range.first, range.second);
The…

David
- 325
- 2
- 12