1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03 11 12 // <functional> 13 14 // template<CopyConstructible Fn, CopyConstructible... Types> 15 // unspecified bind(Fn, Types...); 16 // template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 17 // unspecified bind(Fn, Types...); 18 19 // http://llvm.org/bugs/show_bug.cgi?id=16385 20 21 #include <functional> 22 #include <cmath> 23 #include <cassert> 24 25 float _pow(float a, float b) 26 { 27 return std::pow(a, b); 28 } 29 30 int main() 31 { 32 std::function<float(float, float)> fnc = _pow; 33 auto task = std::bind(fnc, 2.f, 4.f); 34 auto task2(task); 35 assert(task() == 16); 36 assert(task2() == 16); 37 } 38