14
मैं इस का उपयोग करते हुए एक संकलन त्रुटि मिलती है:std :: std :: function से बांधें?
std::vector<std::function<int(int)>> functions;
std::function<int(int, int)> foo = [](int a, int b){ return a + b; };
std::function<int(int)> bar = std::bind(foo, 2);
functions.push_back(bar);
त्रुटि मैं मिलता है:
/usr/include/c++/4.6/functional:1764:40: error: no match for call to '(std::_Bind<std::function<int(int, int)>(int)>) (int)'
कोई मुझे बताओ कैसे एक std::function
में एक std::bind
कन्वर्ट करने के लिए कर सकते हैं?
'' foo' नहीं, लेकिन उससे अलग है। – Xeo
आपको नामस्थान std :: प्लेसहोल्डर्स का उपयोग करने की भी आवश्यकता है। – juanchopanza
@Xeo ने तय किया कि – inkooboo