n3337の147ページ7.1.6.2 Simple type specifiersの5でデストラクタをdeleteしている、何かのサンプル・コードが記載されているのですが、やはり意味がある使い方には見えませんでした。
C++
1template<class T>structA{~A()= delete;};2template<class T>autoh()3-> A<T>;4template<class T>autoi(T)// identity5-> T;6template<class T>autof(T)// #17->decltype(i(h<T>()));// forces completion of A<T> and implicitly uses8// A<T>::˜A() for the temporary introduced by the9// use of h(). (A temporary is not introduced10// as a result of the use of i().)11template<class T>autof(T)// #212->void;13autog()->void{14f(42);// OK: calls #2. (#1 is not a viable candidate: type15// deduction fails (14.8.2) because A<int>::~A()16// is implicitly used in its decltype-specifier)17}18template<class T>autoq(T)19->decltype((h<T>()));// does not force completion of A<T>; A<T>::˜A() is20// not implicitly used within the context of this decltype-specifier21voidr(){22q(42);// Error: deduction against q succeeds, so overload resolution23// selects the specialization “q(T) -> decltype((h<T>())) [with T=int]”.24// The return type is A<int>, so a temporary is introduced and its25// destructor is used, so the program is ill-formed.26}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。