Prev: "Scoping" variables the middle of their "natural" scope - RAII - is it a good practice?
Next: Announce: Interval Template Library (itl): Generic interval containers.
From: Piotr Wyderski on 17 Jan 2010 21:49 Is it possible to overload a method M in such a way that the variant is chosen based on the number of lambda parameters? For example: struct S { template <typename T> void M(... }; S s; s.M([](double v) { return v; }); // Variant #1 s.M([](double v, int x, int y) { return v + x + y; }); // Variant #2 If yes, then how? BTW, what _exactly_ are lambdas expected to be? They are not functions, as they are passed by a template type parameter, but they are also not types, as it's impossible to declare: typedef [](){} nop_t; Best regards Piotr Wyderski -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |