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
Test3
boost::geometry::distance performance overhead compared to a straightforward implementation
Own initialization
the usual name hiding rules do apply with using directives
unordered graphs search
Unlike C (even C99/C11), C++ allows initializers in if-conditions, so this compiles.
Recursive Call Example Sum
Graphs Iteration2 Directed Graphs
pointer to complete array does not convert implicitly to pointer to array of unknown bound
marquee text in C++