Re: Template specialization to get just-wide-enough integer
From: Simon Trew (noneofyour_at_business.guv)
Date: 10/29/04
- Next message: David Lowndes: "Re: Bug? in VC6/VC7.0-- template specialization does not require template<> syntax"
- Previous message: Simon Trew: "Re: va_list length and variable len parameters in macro"
- In reply to: Mycroft Holmes: "Re: Template specialization to get just-wide-enough integer"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 29 Oct 2004 10:45:47 +0100
> template < typename TL, size_t MINSIZE, typename ERROR_T = TypeError >
> struct find_if_at_least
> {
> typedef typename
> TypeIF
> < (sizeof(typename TL::first_type)>=MINSIZE),
> typename TL::first_type,
> typename find_if_at_least< typename TL::tail_type, MINSIZE,
> ERROR_T>::type
> >::type
> type;
> };
>
But then I have to specify my size in bytes (chars) rather than bits, right?
Because you're using sizeof. I guess I could just do sizeof(typename
TL::first_type)*8 >=MINSIZE), right? (I will assume 8 bits to the byte).
I like that you don't actually have to know the sizes of the integer types
to do the specializations for them.
- Next message: David Lowndes: "Re: Bug? in VC6/VC7.0-- template specialization does not require template<> syntax"
- Previous message: Simon Trew: "Re: va_list length and variable len parameters in macro"
- In reply to: Mycroft Holmes: "Re: Template specialization to get just-wide-enough integer"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|