container-data-type Questions
4
Solved
Is there a sorted container in the STL?
What I mean is following: I have an std::vector<Foo>, where Foo is a custom made class. I also have a comparator of some sort which will compare the ...
Koetke asked 23/3, 2013 at 1:49
11
When I do this:
std::vector<int> hello;
Everything works great. However, when I make it a vector of references instead:
std::vector<int &> hello;
I get horrible errors like
...
Coterminous asked 28/5, 2009 at 18:4
7
Solved
Every standard container has a begin and end method for returning iterators for that container. However, C++11 has apparently introduced free functions called std::begin and std::end which call the...
Dumbbell asked 29/9, 2011 at 6:0
10
Solved
I've been reading up on STL containers in my book on C++, specifically the section on the STL and its containers. Now I do understand each and every one of them have their own specific properties, ...
Celio asked 23/1, 2009 at 0:31
3
Solved
I have a container with shared_ptr<>, e.g. a vector<shared_ptr<string>> v and I'd like to iterate over v indicating const-ness.
This code:
vector<shared_ptr<string>>...
Circumstantial asked 29/12, 2015 at 17:27
5
Solved
I have a number of unrelated types that all support the same operations through overloaded free functions (ad hoc polymorphism):
struct A {};
void use(int x) { std::cout << "int = " <<...
Ranjiv asked 17/9, 2013 at 18:5
5
Solved
The STL reference seems to make a conceptual difference between :
'Sequence containers' (array vector deque forward_list list) on one hand
'Associative containers' (set multiset map multimap unor...
Microgroove asked 7/6, 2013 at 10:11
8
Solved
It often happens to me to have a a container C (or whatever kind of wrapper class, even smart pointers) for a type T1, and want to convert such C<T1> into C<T2>, where T2 is compatible ...
Zamboanga asked 5/1, 2011 at 15:14
3
Solved
Is there is a difference between size_t and container::size_type?
What I understand is size_t is more generic and can be used for any size_types.
But is container::size_type optimized for specifi...
Wilkey asked 27/5, 2009 at 23:56
1
© 2022 - 2024 — McMap. All rights reserved.