[typeof] is T registered?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[typeof] is T registered?

Andy Little
Hi to the typeof developers,

    I am wondering if it is possible to add some functionality so user can tell
if a type is in the database of registered types during compilation. It may be
there already of course.

template <typename T>
struct  Func{
    //one possible use case
    typedef  typename boost::mpl::eval_if<
        boost::is_typeof_registered<T>,    // true if T is registered
        typeof_operation<T>, // use BOOST_TYPEOF
        try_something_else<T>
    >::type type;

};

Its not critical, but I thought it might be useful while libraries are adding
the typeof functionality. Also might help me in the  "[typeof] gcc and typeof in
function return type" thread.


regards
Andy Little







_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [typeof] is T registered?

Peder Holt
On 2/7/06, Andy Little <[hidden email]> wrote:

> Hi to the typeof developers,
>
>     I am wondering if it is possible to add some functionality so user can tell
> if a type is in the database of registered types during compilation. It may be
> there already of course.
>
> template <typename T>
> struct  Func{
>     //one possible use case
>     typedef  typename boost::mpl::eval_if<
>         boost::is_typeof_registered<T>,    // true if T is registered
>         typeof_operation<T>, // use BOOST_TYPEOF
>         try_something_else<T>
>     >::type type;
>
> };
>
> Its not critical, but I thought it might be useful while libraries are adding
> the typeof functionality. Also might help me in the  "[typeof] gcc and typeof in
> function return type" thread.
>
>
> regards
> Andy Little
>

This was discussed here:
http://thread.gmane.org/gmane.comp.lib.boost.devel/125765

We never implemented this, as there was never any feedback that anyone
would use it.

Regards
Peder


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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [typeof] is T registered?

Andy Little

"Peder Holt"  wrote
>
> This was discussed here:
> http://thread.gmane.org/gmane.comp.lib.boost.devel/125765
>
> We never implemented this, as there was never any feedback that anyone
> would use it.

On second thoughts, If user hasnt registered type with typeof, then all you are
can do is to expect they are registered with another type deduction scheme. If
they have done that they can just as easily register with typeof.

Therefore its best not to  provide anything so everyone gets into the habit of
registering with typeof.

Thanks for the insight and links.

regards
Andy Little




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [typeof] is T registered?

Arkadiy Vertleyb
In reply to this post by Andy Little
"Andy Little" <[hidden email]> wrote

>     I am wondering if it is possible to add some functionality so user can
tell
> if a type is in the database of registered types during compilation. It
may be

> there already of course.
>
> template <typename T>
> struct  Func{
>     //one possible use case
>     typedef  typename boost::mpl::eval_if<
>         boost::is_typeof_registered<T>,    // true if T is registered
>         typeof_operation<T>, // use BOOST_TYPEOF
>         try_something_else<T>
>     >::type type;
>
> };
>
> Its not critical, but I thought it might be useful while libraries are
adding
> the typeof functionality. Also might help me in the  "[typeof] gcc and
typeof in
> function return type" thread.

Doesn't the workaround I provided help?

Regards,
Arkadiy



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [typeof] is T registered?

Andy Little

"Arkadiy Vertleyb"  wrote
> "Andy Little" wrote

>> Its not critical, but I thought it might be useful while libraries are
> adding
>> the typeof functionality. Also might help me in the  "[typeof] gcc and
> typeof in
>> function return type" thread.
>
> Doesn't the workaround I provided help?

Yes. Thanks!

regards
Andy Little



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