This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 01/12/05 13:10, Smith-Rowland, Edward M (Contractor) wrote:
>
> Here's a schematic:
>
> template< typename Numeric >
> Numeric __func( Numeric x )
> {
> if ( ! std::tr1::is_floating_point< Numeric >::value )
> {
> throw std::domain_error;
> }
>
> if ( sizeof( Numeric ) == sizeof( double )
> {
> // Initialize for double algorithm.
> }
>
> ...
> }
I would suggest that a compile-time error be produced instead of a runtime
error for invalid template parameters. Something like the following.
typedef typename __enable_if<result_type,
is_floating_point<result_type>::value
>::__type is_valid_type;
Just, you know, in case you're serious about implementing these.
--
Stephen M. Webb
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |