Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
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
Please
log in
to post a comment.
Specialization on signed types
Rounding float to nearest 1000
ECE2574_Function_Calling_Example
INHERIT_CTORS default constructor
GraphBase
for_each_argument
10226
Throttle Example in C++ (80 requests every 2 seconds)
ArrayList Example Starter Code 2
MPL 2-1
Please log in to post a comment.