c++ - compiler confusion on functions with tuple arguments -
i using apple's llvm 4.2 compiler compile c++ code. have overloaded member function different tuple combinations, , believe calling correctly 1 of them, yet compiler finds ambiguity. in essence, trying call method (1) below, yet compiler finds method (2) acceptable/compatible. why that? have c++11 flags turned on.
enum class enum1 { ... } enum class enum2 { ... } enum class enum3 { ... } enum class enum4 { ... } void mymethod() { enum1 e1; enum2 e2; enum3 e3; dosomething({e1,e2,e3}); // should pick (1), yet compiler finds (2) compatible also!? } inline void dosomething(const tuple<enum1,enum2,enum3>& p) { // (1) ... } inline void dosomething(const tuple<enum1,enum2,enum3,enum4>& p) { // (2) ... }
are sure compiler finds both acceptable, , doesn't none acceptable , lists candidates? std::tuple's argument-per-element constructor explicit, , not eligible when comes copy-initializing parameter braced initializer. in other words, neither function should selected.
you need explicitly construct tuple in argument.
Comments
Post a Comment