X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_smart_ptr.h;h=479c9668dde683c7cd9dc620c4fba8d28b3e16d7;hb=771388a04b903a5f9551362b143cd8f3e520b37f;hp=4609880c1ebc2fb5fa81216ac84a15e26a06154a;hpb=b3016b249333ac0ab0008d8c6c4d9029b2ff30c9;p=synfig.git diff --git a/ETL/trunk/ETL/_smart_ptr.h b/ETL/trunk/ETL/_smart_ptr.h index 4609880..479c966 100644 --- a/ETL/trunk/ETL/_smart_ptr.h +++ b/ETL/trunk/ETL/_smart_ptr.h @@ -178,19 +178,6 @@ public: pointer operator->()const { assert(obj); return obj; } - //! Overloaded cast operator -- useful for implicit casts - template - operator smart_ptr() - { - // This next line should provide a syntax check - // to make sure that this cast makes sense. - // If it doesn't, this should have a compiler error. - // Otherwise, it should get optimized right out - // of the code. - //(U*)obj; - - return *reinterpret_cast*>(this); - } operator smart_ptr()const { return smart_ptr(static_cast(obj)); } @@ -217,6 +204,20 @@ public: bool operator!()const { return !obj; } + //! Overloaded cast operator -- useful for implicit casts + template + operator smart_ptr() + { + // This next line should provide a syntax check + // to make sure that this cast makes sense. + // If it doesn't, this should have a compiler error. + // Otherwise, it should get optimized right out + // of the code. + //(U*)obj; + + return *reinterpret_cast*>(this); + } + }; // END of template class smart_ptr // ========================================================================