Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
shared_ptr deleter
//g++ 4.9.3 #include <iostream> #include <memory> struct Connection { std::shared_ptr<int> ts; }; Connection* generateConnection(int* tss) { Connection* c = new Connection; struct Del { void operator()(int* ptr) const { std::cout << "Deleting ptr" << std::endl; if(ptr) delete [] ptr; } }; c->ts.reset(tss, Del()); return c; } int main() { std::unique_ptr<Connection> con(generateConnection(new int[4]{1,2,3})); }
run
|
edit
|
history
|
help
0
ExceptionHandling4
OTHER - Two robots
QuickSort
ThreadPool
BubDoubArray
new delete malloc free
Simple enemy polimorphism
Stats - Central Limit Theorem - Normal Distribution with multiple items
Addition of two matrix **Part 2
Shortest Non Common Subsequence