On Sun, 10 Aug 2003 03:33:50 -0400, "Eric Friedman"
<[EMAIL PROTECTED]> wrote:

>Dave (and others):
>
>Eric Friedman wrote:
>> David Abrahams wrote:
>> >
>> > Hi,
>> >
>> > BOOST_EXPLICIT_TEMPLATE_TYPE is great!
>> >
>> > However:
>> [snip]
>> >     // specialization
>> >     template <>
>> >     int f<void>( /*what goes here?*/ )
>> >     {
>> >
>> >     }
>> >
>> > we have no mechanism for handling these.  Any ideas?
>>
>> Wouldn't BOOST_EXPLICIT_TEMPLATE_TYPE(void) work?
>
>Ooops, you're right. Guess I don't know the standard well enough.
>
>I've added BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC (and so on) helper macros to
>address this problem (in config/suffix.hpp) since it's actually been
>creating problems with variant under gcc. Let me know if this solution
>doesn't meet your expectations.

It may help to paste here what I said to Dave in the first place (he
wrote privately too, and since I wasn't following the list I didn't
notice that a copy was also posted here):


--------------
> However:
> 
>     template <class T>
>     int f(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
>     {
>        ...
>     }
>     
>     // specialization
>     template <>
>     int f<void>( /*what goes here?*/ )
>     {
> 
>     }
> 
> we have no mechanism for handling these.  Any ideas?

Hmm... no, because then you clash with other VC6 bugs (concerning
default arguments).

Of course you can't put BOOST_EXPLICIT_TEMPLATE_TYPE(void) because it
re-defaults the dummy argument (which is illegal) but even without the
default... :-( For instance:

  template <class T>
  int f( boost::type<T>* = 0 )
  {
     return 0;
  }
    
  // specialization
  template <>
  int f( boost::type<void> * )
  {
     return 1;
  }

  int main()
  {
    std::cout << f<int>() << '\n';
    std::cout << f<void>() << '\n';
    return 0;
  }

VC6 says "error C2660: 'f' : function does not take 0 parameters" at
the line that contains the call to f<void>.

----------------------


Genny.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to