Skip to main content

All Questions

4 votes
1 answer
117 views

Matrix template Class

This is my 2nd shot at dynamic memory allocation. This project is for practice purposes. So many things were considered whilst writing this minimal project. I considered using placement new to ...
theProgrammer's user avatar
4 votes
1 answer
88 views

protein sequence translator using basic text manipulation

As an old COBOL coder, all this OOP stuff is foriegn. Would someone please take a look at this program? I'm looking for suggestions for ways to improve this program. While it works, I'm sure there's ...
Phil Huffman's user avatar
2 votes
4 answers
131 views

I'm deallocating objects created but I'm unsure whether my code is leaking memory or not

I have a simple application which requires the user to input details about students and their grades. I have two different classes Student and ...
mhmrhiman's user avatar
8 votes
1 answer
119 views

Tracker for object construction, copy, and movement

I made an object tracker for debugging and testing purposes called ccm_counter (construction, copy, move counter). It counts constructor, copy and move calls. It ...
Timo's user avatar
  • 363
12 votes
2 answers
2k views

Weapon and Hero classes

For me as a complete newbie to the world of C++, getters and setters are a rather confusing topic. There seems to be a wide range of opinions on what constitutes a sound use of getters and setters. In ...
Michael Langbein's user avatar
7 votes
2 answers
1k views

Implementing a copy on write String class using reference counting in C++

I have tried to implement a copy on write string class with value semantics and reference counting. I wanted to support indexing, so I have overloaded the operator[] and to differentiate between the ...
sunil pai's user avatar
6 votes
2 answers
5k views

Fixed size Memory Pool Implementation

Here is an attempt at implementing a fixed size Memory Pool1: pool.h ...
Ziezi's user avatar
  • 1,174
2 votes
2 answers
2k views

Simple class to mimic a dynamic array

for my c++ class I was asked to write a class with the following characteristics: Implement a vector replacement that operates only on integers (you don't need to use templates like the normal STL)...
Obito's user avatar
  • 23
5 votes
2 answers
3k views

C++ object pool

I am a beginner and would like to build a pool. I made some research and found out that if my software has heavy object create and delete part, I should use a pool because of performance. I made some ...
Tibor's user avatar
  • 51
3 votes
3 answers
899 views

Drawing superellipses

Here is a piece of code that draws superellipses: ...
Ziezi's user avatar
  • 1,174
6 votes
1 answer
2k views

Applying the copy-swap idiom to humans and employees

I came across this post which explains the copy and swap idiom. However I could not find this idiom applied to classes that have base classes. Following is my attempt of a copy-swap idiom applied to ...
James Franco's user avatar
1 vote
2 answers
302 views

RAII and code duplication in constructor/destructor

I have a class hierarchy similar to this: ...
Ugo's user avatar
  • 321
5 votes
1 answer
291 views

Could this depth system for a game be improved?

I am still new to C++ and don't have a great insight on my coding yet, so I would be very grateful to anyone and everyone that gives advice. Also, this code is meant to: keep all of my objects in an ...
Andrew's user avatar
  • 555