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// <functional> 11 12// template<CopyConstructible Fn, CopyConstructible... Types> 13// unspecified bind(Fn, Types...); 14// template<Returnable R, CopyConstructible Fn, CopyConstructible... Types> 15// unspecified bind(Fn, Types...); 16 17// http://llvm.org/bugs/show_bug.cgi?id=16385 18 19#include <functional> 20#include <cmath> 21#include <cassert> 22 23float _pow(float a, float b) 24{ 25 return std::pow(a, b); 26} 27 28int main() 29{ 30 std::function<float(float, float)> fnc = _pow; 31 auto task = std::bind(fnc, 2.f, 4.f); 32 auto task2(task); 33 assert(task() == 16); 34 assert(task2() == 16); 35} 36