- 771 名前:デフォルトの名無しさん mailto:sage [2024/01/30(火) 20:47:22.29 ID:RcbbllHt.net]
- bだけ通らないのが納得いかない…。
#include<iostream> #include<functional> using F = std::function<void()>; void f0(){} F f1; class X { F f; public: X(const F& f_) : f(f_){} X& operator=(const F& f_){f = f_; return *this;} }; int main(){ X x1(f0); // a:OK X x2 = f0; // b:NG(conversion from ‘void()’ to non-scalar type ‘X’ requested) X x3 = f1; // c:OK x1 = f0; // d:OK }
|

|