[complement-svn] SF.net SVN: complement:[1969] trunk/complement/explore/lib/misc/ut
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-10-13 10:33:16
|
Revision: 1969 http://complement.svn.sourceforge.net/complement/?rev=1969&view=rev Author: complement Date: 2008-10-13 10:33:10 +0000 (Mon, 13 Oct 2008) Log Message: ----------- attempt to test presence of some ctor in class really I can't do this: impossible take address of ctor Modified Paths: -------------- trunk/complement/explore/lib/misc/ut/misc_test.cc trunk/complement/explore/lib/misc/ut/misc_test.h Modified: trunk/complement/explore/lib/misc/ut/misc_test.cc =================================================================== --- trunk/complement/explore/lib/misc/ut/misc_test.cc 2008-09-10 06:18:29 UTC (rev 1968) +++ trunk/complement/explore/lib/misc/ut/misc_test.cc 2008-10-13 10:33:10 UTC (rev 1969) @@ -580,3 +580,44 @@ return EXAM_RESULT; } +struct X +{ +}; + +struct Y +{ + Y() + { } + Y( const X& ) + { } +}; + +template <class T> +struct __ctor_aux : // union or class + public std::tr1::detail::__select_types +{ + private: + template <class _Up> + static __t1 __test( int (_Up::*)() ); + + template <class> + static __t2 __test(...); + + public: +#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION + static const bool __value; +#else + static const bool __value = sizeof(__test<T>(0)) == sizeof(std::tr1::detail::__select_types::__t1); +#endif +}; + +#ifdef __FIT_NO_INLINE_TEMPLATE_STATIC_INITIALISATION +template <class T> +const bool __ctor_aux<T>::__value = sizeof(__ctor_aux<T>::__test<T>(0)) == sizeof(std::tr1::detail::__select_types::__t1); +#endif + +int EXAM_IMPL(type_traits_has_x_ctor) +{ + return EXAM_RESULT; +} + Modified: trunk/complement/explore/lib/misc/ut/misc_test.h =================================================================== --- trunk/complement/explore/lib/misc/ut/misc_test.h 2008-09-10 06:18:29 UTC (rev 1968) +++ trunk/complement/explore/lib/misc/ut/misc_test.h 2008-10-13 10:33:10 UTC (rev 1969) @@ -1,7 +1,7 @@ // -*- C++ -*- Time-stamp: <08/06/30 12:40:05 yeti> /* - * Copyright (c) 2007 + * Copyright (c) 2007, 2008 * Petr Ovtchenkov * * Licensed under the Academic Free License Version 3.0 @@ -52,6 +52,9 @@ int EXAM_DECL(type_traits_is_pod); int EXAM_DECL(type_traits_is_pod_compiler_supp); int EXAM_DECL(type_traits_is_empty); + + // aux + int EXAM_DECL(type_traits_has_x_ctor); }; #endif // __MISC_TEST_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |