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
EBO
Compute Power Manually
Move Construction
Ordered Graphs
Calculate H.C.F using recursion
Dat pointers
BucketSort
BinaryGap, C++ - Find longest sequence of zeros in binary representation of an integer.
K combinator - Lazy evaluation
sort