mirror of
https://github.com/libretro/cpp-cheat.git
synced 2025-02-21 08:40:59 +00:00
Smart pointer, member variable
This commit is contained in:
parent
7a3b3543fa
commit
d4b082e4d6
@ -21,7 +21,7 @@ all: $(OUTS) $(OUTS_CPP)
|
||||
gcc -O'$O' -g'$(G)' -o '$@' -pedantic-errors -std=c89 -Wextra '$<'
|
||||
|
||||
%$(OUT_EXT): %$(IN_EXT_CPP)
|
||||
g++ -O'$O' -g'$(G)' -o '$@' -pedantic-errors -std=c++98 -Wextra '$<'
|
||||
g++ -O'$O' -g'$(G)' -o '$@' -pedantic-errors -std=c++11 -Wextra '$<'
|
||||
|
||||
clean:
|
||||
rm -f *$(OUT_EXT)
|
||||
|
@ -6,8 +6,9 @@ Method
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
void myMethod() {
|
||||
std::cout << "My method" << std::endl;
|
||||
int myVar;
|
||||
int myMethod() {
|
||||
return myVar + 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
17
gdb/smart_pointer.cpp
Normal file
17
gdb/smart_pointer.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
https://stackoverflow.com/questions/22798601/how-to-debug-c11-code-with-unique-ptr-in-ddd-or-gdb
|
||||
*/
|
||||
|
||||
#include <memory> // unique_ptr
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
int myMethod() {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
std::unique_ptr<MyClass> p(new MyClass());
|
||||
p->myMethod();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user