Simplied bind using __invoke. In the process, found and fixed a couple of bugs. C++11 only.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -264,4 +264,5 @@ int main()
|
||||
{
|
||||
test_void_1();
|
||||
test_int_1();
|
||||
test_void_2();
|
||||
}
|
||||
|
@@ -241,8 +241,26 @@ test_void_2()
|
||||
}
|
||||
}
|
||||
|
||||
int f_nested(int i)
|
||||
{
|
||||
return i+1;
|
||||
}
|
||||
|
||||
int g_nested(int i)
|
||||
{
|
||||
return i*10;
|
||||
}
|
||||
|
||||
void test_nested()
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
assert(std::bind(f_nested, std::bind(g_nested, _1))(3) == 31);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_void_1();
|
||||
test_int_1();
|
||||
test_void_2();
|
||||
test_nested();
|
||||
}
|
||||
|
Reference in New Issue
Block a user