print full function name
This commit is contained in:
parent
0aee7de352
commit
4b5a124aa1
2 changed files with 50 additions and 23 deletions
33
example.cpp
33
example.cpp
|
|
@ -1,7 +1,36 @@
|
|||
// -*- compile-command: "g++ -Iinclude -D_GLIBCXX_DEBUG -fsanitize=address,undefined -g3 -ggdb3 -std=c++17 example.cpp -o example && SOI_H_COLOR=1 SOI_H_EOFCHECK=1 ./example <<< ''" -*-
|
||||
// -*- compile-command: "g++ -Iinclude -D_GLIBCXX_DEBUG -fsanitize=address,undefined -g3 -ggdb3 -std=c++17 example.cpp -o example && SOI_COLOR=1 SOI_EOFCHECK=1 ./example <<< ''" -*-
|
||||
#include <soi>
|
||||
|
||||
inline std::string methodName(const std::string& prettyFunction) {
|
||||
size_t colons = prettyFunction.find("::");
|
||||
size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1;
|
||||
size_t end = prettyFunction.rfind("(") - begin;
|
||||
return prettyFunction.substr(begin,end) + "()";
|
||||
}
|
||||
|
||||
struct A{
|
||||
void operator()() const {
|
||||
dbg(methodName(__PRETTY_FUNCTION__));
|
||||
dbg("here");
|
||||
}
|
||||
void bar(int a, int b, string c) const {
|
||||
dbg("imbar");
|
||||
}
|
||||
void foo(int a=3, int b=5, string c="hi") const {
|
||||
dbg(methodName(__PRETTY_FUNCTION__));
|
||||
dbg("bar");
|
||||
}
|
||||
};
|
||||
|
||||
signed main() {
|
||||
dbg(methodName(__PRETTY_FUNCTION__));
|
||||
A a;
|
||||
a();
|
||||
a.foo();
|
||||
a.bar(3,4,"hi");
|
||||
|
||||
int l=3, r=5;
|
||||
dbg(tuple{l, r});
|
||||
dbg();
|
||||
dbg("hi");
|
||||
string s="world";
|
||||
|
|
@ -17,6 +46,6 @@ signed main() {
|
|||
dbg(vector<pair<int, vector<string>>>{{3,{"hi"}},{4,{"hello", "world"}}});
|
||||
dbg(set<int>{3,1,4});
|
||||
dbg(map<int, string>{{3,"three"},{1,"one"}});
|
||||
dbg(unordered_map<int, string>{{3,"three"},{1,"one"}});
|
||||
dbg(tuple{unordered_map<int, string>{{3,"three"},{1,"one"}}});
|
||||
dbg(unordered_set<int>{3,1,4});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue