Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
6 votes
3 answers
1k views

Simple Container Class

I'm learning C++ and trying to create my own container class just for practice (I know about vector, list, map, set). I plan to improve this class and add new methods as I learn new material. Please ...
vansergh's user avatar
  • 161
7 votes
1 answer
348 views

Custom implementation to provide an immutable range of a container without copying it

I needed to pass a const reference to part of a std::vector without copy. I posted the previous version in my earlier question, thank you for the great support! As ...
Dávid Tóth's user avatar
2 votes
1 answer
941 views

Generic Doubly Linked-list implementation in C++

I am just learning about C++ templates and generic types, I decided it would be nice to try to create a generic container class as a challenge and test my knowledge in the process. Here is what I have ...
user avatar
1 vote
2 answers
83 views

Class template, custom container

So I wrote this class template for a custom container. Basically, it stores elements and their occurences. When an element is pushed into the container, if it ...
Khanoa's user avatar
  • 35
1 vote
2 answers
1k views

Creating a custom template container class (vector alike)

What can be done better? What should I learn to make these tasks better and more efficiently? The template (template.h): ...
cornhedgehog's user avatar
2 votes
1 answer
499 views

Auto-resizing array, that accepts negative indexes

I've been coding a helper container template to contain tiles in 2D games. What I figured out I would like when writing code for my games is forgetting all resize stuff, allowing negative indexes (for ...
Yk Cheese's user avatar
  • 113
8 votes
1 answer
301 views

Associative container that produces a unique, instance specific handle for each inserted object

It is not always possible to simplify program design by strictly managing the lifetimes of objects. If two objects have unpredictable lifetimes, but one of them needs to refer to the other, a simple ...
jms's user avatar
  • 495
10 votes
1 answer
2k views

Is my C++11 generic container a good design?

After refactors and refactors and the discovery of very common patterns on many of the classes of the software I wrote, I decided that it would be fine to have something like an arbitrary-keyed map, ...
Jean-Michaël Celerier's user avatar
2 votes
2 answers
7k views

Simple container class with templates

I've been working on a simple program to output values to the console as a learning project, and I stumbled across an article advising against using 2D containers, suggesting to simulate them instead ...
bazola's user avatar
  • 8,569