Questions tagged [pointers]
In computer science, a pointer is a programming language data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.
384
questions
-1
votes
0
answers
19
views
Libsodium Encrypt using API methods and pointers [closed]
As I have not found a code snippet to use libsodium with pointers, I would like to ask whether there are memory leaks in the code below or if anything else is wrong.
...
2
votes
1
answer
80
views
Compare and merge sets from unstructured variables for automatic differentiation
I have developed an automatic differentiation module for my software. Usually AD comes in two forms; forward mode or reverse mode and very clever approaches, beyond me, might mix both. Typically the ...
4
votes
1
answer
160
views
Trie implementation using std::shared_ptr
I've implemented a basic Trie that is supposed to work only with lowercase English letters.
...
2
votes
2
answers
267
views
Optimizing Subarray Removal: Can the Removal Process be Enhanced for Better Efficiency?
The only requirement is that it has to be done by pointers:
And it returns the amount of removed numbers because of the way of output that is set in the main.
The function, using exclusively pointer ...
8
votes
3
answers
2k
views
"Smart" (ish) pointer in C
I am a programmer with a primarily Rust-based background who has nonetheless taken an interest in C lately due to its simplicity and minimalism. However, one of the things I miss most from Rust is ...
4
votes
1
answer
95
views
Member (virtual or not) function to C callback by generating static version at compile time
I've started to write a header-only implementation of callback for member functions :
...
1
vote
3
answers
210
views
A shared pointer which can delete the managed object before the usage count reaches zero
When I was working on my game engine, I needed to know if a game object has been destroyed or not. So, I decided to use std::shared_ptr. But the standard shared ...
2
votes
2
answers
431
views
C++ std::shared_ptr implementation
Took a shot at implementing std::shared_ptr, with a thread-safe refcount and weak count. Didn't do weak_ptr, I'm doing this for ...
4
votes
2
answers
321
views
A memory leak-free RAII wrapper around two raw pointers
As a practice of implementing RAII-enabled class, I prepared a class called DynamicWallet that wraps around two raw pointers. I am well aware that using smart ...
2
votes
0
answers
48
views
Reusable storage for array of objects V4
Here is a thirdfollow up on Reusable storage for array of objects, Reusable storage for array of objects V2 and Reusable storage for array of objects V3, taking into account the provided answers.
The ...
1
vote
1
answer
48
views
Reusable storage for array of objects V3
Here is a second follow up on Reusable storage for array of objects and Reusable storage for array of objects V2, taking into account the provided answers.
The following code should be compliant at ...
3
votes
1
answer
66
views
Reusable storage for array of objects V2
Here is a follow up on Reusable storage for array of objects, taking into account the provided answers.
The following code should be compliant at least with gcc, <...
4
votes
2
answers
487
views
Reusable storage for array of objects
My goal is to have a memory pool non-template class that is used to store arrays of objects.
The same memory pool object must be reusable for a different array (difference size, different type and/or ...
5
votes
2
answers
208
views
C++ UniquePtr Implementation
Took a shot at implementing std::unique_ptr.
Code:
...
7
votes
2
answers
203
views
shared_ptr implementation code - first cut
I've written an implementation of shared_ptr. It doesn't support weak_ptr (yet) but below is the code. I'd appreciate any feedback, comments.
...