#include <iostream>
using namespace std;
namespace
{
void f()
{
auto func = []()->const char *{ return(__func__); };
auto func2 = []()->const char *{ return(__PRETTY_FUNCTION__); }; //GCC extension
cout << func() << '\n'
<< func2() << '\n'
<< __func__ << '\n'
<< __PRETTY_FUNCTION__ << endl;
}
}
int main()
{
f();
cout << __func__ << '\n'
<< __PRETTY_FUNCTION__ << endl;
return(0);
}
Output:
/tmp> g++-4.5 -Wall -o test test.cpp -std=c++0x
/tmp> ./test
operator()
<unnamed>::f()::<lambda()>
f
void<unnamed>::f()
main
int main()
/tmp>
/tmp> g++-4.6 -Wall -o test test.cpp -std=c++0x
/tmp> ./test
operator()
{anonymous}::f()::<lambda()>
f
void {anonymous}::f()
main
int main()
/tmp>
1 comment:
You got me there, I have no idea what the top two tests are supposed to mean.
And here I thought that I knew how c++ syntax looks like.
Post a Comment