X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2FETL%2F_trivial.h;h=6d82bfa20d4e2137747b2d547fd2242a86ae6075;hb=cee5940bae97612105db8b7e1ffcf513f9d9150c;hp=4732ad3212ddc0823988e6be74a8ff88fa82aaf8;hpb=dee84efa006428fdfbf0e84b66ee94eb23113ad9;p=synfig.git diff --git a/ETL/trunk/ETL/_trivial.h b/ETL/trunk/ETL/_trivial.h index 4732ad3..6d82bfa 100644 --- a/ETL/trunk/ETL/_trivial.h +++ b/ETL/trunk/ETL/_trivial.h @@ -55,33 +55,33 @@ class trivial typedef const T& const_reference; typedef T* pointer; typedef const T* const_pointer; - + char data[sizeof(T)]; public: - operator reference() + operator reference() { return *reinterpret_cast(data); } // HACK - Rather dangerous - //operator reference()const + //operator reference()const //{ return *reinterpret_cast(const_cast(data)); } - - operator const_reference()const + + operator const_reference()const { return *reinterpret_cast(data); } - + reference get() { return *reinterpret_cast(data); } const_reference get()const { return *reinterpret_cast(data); } - + void construct() { new(&get()) value_type(); } void destruct() { get().~value_type(); } - + void destroy() { destruct(); } - + template reference operator=(const U &rhs) { return get()=rhs; } @@ -125,11 +125,11 @@ public: template reference operator<<=(const U &rhs) { return get()<<=rhs; } - - operator bool()const + + operator bool()const { return get(); } - bool operator!()const + bool operator!()const { return !get(); } }; // END of template class trivial