Skip to main content

All Questions

Tagged with
8 votes
1 answer
731 views

Implementation of a new kind of smart pointer in C++

I'm tempted to write a new kind of smart pointer which, I believe, is less intrusive than boost::intrusive_ptr and has the same memory footprint. The code for the ...
Diego Sogari's user avatar
5 votes
2 answers
2k views

C++ smart pointers and classes

I've started learning C++ recently and want from what I've gathered smart pointers are the way to go when storing stuff on the free store. I want to make sure I've got the basic hang of C++(11) ...
user avatar
2 votes
1 answer
112 views

Pointer handle - absolute follow-up

This is a follow-up to: Pointer handle - follow-up Pointer class/handle Please review my pointer class. ...
lightning_missile's user avatar
4 votes
2 answers
102 views

Pointer handle - follow-up

This is a followup to: Pointer class/handle Please review this pointer class. ...
lightning_missile's user avatar
2 votes
1 answer
111 views

Pointer class/handle

Please review my pointer class. ...
lightning_missile's user avatar
6 votes
1 answer
91 views

Pointer handle - only allocates in stack

This is a pointer class of mine that I would like to have reviewed. Right now it only allocates in the stack and has no copy or move operations. ...
lightning_missile's user avatar
2 votes
2 answers
5k views

Binary search tree with templates

I am currently attempting to become proficient in C++ and started by implementing a basic binary search tree. Most of the programming I have done is in Ada, Python and C. I would like to be able to ...
Dirty Mike and the Boys's user avatar
6 votes
2 answers
1k views

Constructing a graph and performing a depth-first traversal

Please review the use of pointers and design in graph construction code and its depth first traversal. I haven't used smart pointers as I want to understand any issues in following implementation with ...
technophile's user avatar
2 votes
2 answers
872 views

Speeding up and shortening a loop [closed]

I'm still relatively new to C++ and I've written a program that could do with being a bit shorter and faster. I use this same set of for loops many times to cycle through the whole tree of values. I'...
fiz's user avatar
  • 139
11 votes
5 answers
3k views

Custom class for a borrowed unique_ptr<T>?

In C++11, I tend to have master objects that maintain sole ownership of a collection of some children objects. Let's assume these children objects are non-copyable (for instance, ...
Max's user avatar
  • 213
4 votes
1 answer
4k views

Implement a string in reverse using pointers and recursion

I'm trying to reverse a string using pointers and recursion, and I send it a char array. Is this the best way, or is there a better one? ...
canatan's user avatar
  • 43
7 votes
2 answers
671 views

Layer Stack class to practice std::shared_ptr

The following three source files is to define and test a class StackLayer. While it was written in a need for scalable layer-based architecture design, it was also ...
user2883715's user avatar
5 votes
2 answers
674 views

Singleton typed memory manager

For my resources management, I wanted the objects allocated on the heap to be in a contiguous block of memory. Obviously, each data type then has to have their own chunk of memory. I could have used a ...
rashmatash's user avatar
7 votes
1 answer
2k views

Builder/named argument/fluent interface pattern with unique_ptr

I'm trying to figure out the cleanest way to implement a fluent interface with unique_ptr and other "modern" C++ language constructs. Here's my first attempt: <...
Richard Cook's user avatar
3 votes
1 answer
1k views

Auto-recycling C++11 polymorphic smart pointers

I've recently read an interesting blog post by Philipp Zschoche: it explains how it's possible to avoid unnecessary allocations/deallocations by keeping track of previously allocated memory in a stack....
Vittorio Romeo's user avatar

15 30 50 per page
1
3 4
5
6 7