Boost logo

Boost :

From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2005-12-17 08:21:53


Eric Niebler wrote:
> Eric Niebler wrote:

> Here's my latest attempt. This works on gcc 3.4.4 (cygwin), but not on
> VC7.1 or (sadly) Comeau Online. Language lawyers, start your engines!

Eric, this is very cool :-)

I tried to simplify it a little:

> template<typename T>
> struct probe
> {
> operator T ();
> operator T volatile const &() const;
> };

template<typename T>
struct probe
{
      operator T ();
      operator T&() const;
};

> template<typename T>
> char is_volatile(T const &);
>
> template<typename T>
> double is_volatile(T const volatile &);

template<typename T>
char is_volatile( const T& );

template<typename T>
double is_volatile( T& );

That gave the same results. Then I did

> template<typename T>
> probe<T> make_probe(T const &);

template<typename T>
const probe<T> make_probe(T const &);

Now it works on vc7.1 too. Not como.

I'm not a language specialist and my understanding of ?: comes mainly
from your article. That said, I find the solution very intuitive.

best regards

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk