Proposed change: use BOOST_TYPEOF

View: New views
2 Messages — Rating Filter:   Alert me  

Proposed change: use BOOST_TYPEOF

by Neal Becker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Since we have BOOST_TYPEOF, use it in type_traits.hpp:

    template<class X, class Y>
    struct promote_traits {
        typedef type_deduction_detail::base_result_of<X, Y> base_type;
        static typename base_type::x_type x;
        static typename base_type::y_type y;
//         static const std::size_t size = sizeof (
//                 type_deduction_detail::test<
//                     typename base_type::x_type
//                   , typename base_type::y_type
//                 >(x + y)     // Use x+y to stand of all the arithmetic
actions
//             );

//         static const std::size_t index = (size / sizeof (char)) - 1;
//         typedef typename mpl::at_c<
//             typename base_type::types, index>::type id;
      //        typedef typename id::type promote_type;
      //      typedef typeof (X() + Y()) promote_type;
      typedef BOOST_TYPEOF (X() + Y()) promote_type;
    };


_______________________________________________
ublas mailing list
ublas@...
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: lists@...

Re: Proposed change: use BOOST_TYPEOF

by Gunter Winkler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Neal Becker schrieb:

> Since we have BOOST_TYPEOF, use it in type_traits.hpp:
>
>     template<class X, class Y>
>     struct promote_traits {
>         typedef type_deduction_detail::base_result_of<X, Y> base_type;
>         static typename base_type::x_type x;
>         static typename base_type::y_type y;
> //         static const std::size_t size = sizeof (
> //                 type_deduction_detail::test<
> //                     typename base_type::x_type
> //                   , typename base_type::y_type
> //                 >(x + y)     // Use x+y to stand of all the arithmetic
> actions
> //             );
>
> //         static const std::size_t index = (size / sizeof (char)) - 1;
> //         typedef typename mpl::at_c<
> //             typename base_type::types, index>::type id;
>       //        typedef typename id::type promote_type;
>       //      typedef typeof (X() + Y()) promote_type;
>       typedef BOOST_TYPEOF (X() + Y()) promote_type;
>     };
>
>
>  
This sounds very useful. The provided return type deduction was only
introduced because BOOST_TYPEOF was not available at this time.

mfg
Gunter

_______________________________________________
ublas mailing list
ublas@...
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: lists@...