Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
uniq ptr
#include <iostream> #include <memory> class A{ public: A(int _i):i(_i){} int i = 10; }; void test(A* a){ std::unique_ptr<A> uptr(a); } int main() { int k = 20 ; A* a = new A(k); std::cout << a->i << "\n"; test(a); try{ if( a->i != k) std::cout << a->i << " .. Why?\n"; } catch (std::exception& e){ std::cerr << "Blew Up: " << e.what() << std::endl; } return 0; }
run
|
edit
|
history
|
help
0
chakib
applidiumResto_corrigé
Code Rush Game Group 1
marquee text in C++
Throttle Example using a circular queue (Push all but 2 less than maxSize; then pop all but 2 of current size)
problem_name_1
Member inheritance
bank queue
Maze problem solution
std::function ambiguity clang