FW: Special functions in TR1
Stephen M. Webb
stephenw@xandros.com
Thu Dec 1 19:06:00 GMT 2005
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20051201/876a5de4/attachment.sig>
More information about the Libstdc++
mailing list