From: <mor...@us...> - 2010-12-21 08:52:42
|
Revision: 3879 http://ecell.svn.sourceforge.net/ecell/?rev=3879&view=rev Author: moriyoshi Date: 2010-12-21 08:52:36 +0000 (Tue, 21 Dec 2010) Log Message: ----------- * Make the template constructor not interfere with the constructor from strings. Modified Paths: -------------- ecell3/trunk/ecell/libecs/Polymorph.hpp Modified: ecell3/trunk/ecell/libecs/Polymorph.hpp =================================================================== --- ecell3/trunk/ecell/libecs/Polymorph.hpp 2010-12-21 08:29:57 UTC (rev 3878) +++ ecell3/trunk/ecell/libecs/Polymorph.hpp 2010-12-21 08:52:36 UTC (rev 3879) @@ -47,8 +47,13 @@ #include <boost/range/size.hpp> #include <boost/range/const_iterator.hpp> #include <boost/tuple/tuple.hpp> +#include <boost/mpl/or.hpp> #include <boost/mpl/int.hpp> #include <boost/mpl/less.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_arithmetic.hpp> #include "libecs/Defs.hpp" #include "libecs/convertTo.hpp" @@ -529,14 +534,18 @@ std::size_t sz = static_cast< std::size_t >( -1 ) ) : theValue( PolymorphValue::create( ptr, sz ) ) { } - explicit Polymorph( Real aValue ) + explicit Polymorph( Real aValue ) : theValue( PolymorphValue::create( aValue ) ) { } - explicit Polymorph( Integer aValue ) + explicit Polymorph( Integer aValue ) : theValue( PolymorphValue::create( aValue ) ) { } template< typename Trange_ > - explicit Polymorph( Trange_ const& aValue ) + explicit Polymorph( Trange_ const& aValue, + typename boost::disable_if< + boost::mpl::or_< + boost::is_arithmetic< Trange_ >, + boost::is_same< Trange_, String > > >::type* = 0) : theValue( PolymorphValue::create( aValue ) ) { } template< typename T0_, typename T1_, typename T2_, typename T3_, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |