Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-03-15 19:19:03


"Andy Little" <andy_at_[hidden]> wrote
>
> "Andy Little" <andy_at_[hidden]> wrote
> > "Neal D. Becker" <ndbecker2_at_[hidden]> wrote
> > > I believe some parts of pqs may be just what I need for some other
> > purposes.
>
> [snip]
>
> >
> > >particularly since it
> > > appears to include std::complex.
>
> reviewing my work for binary_operation with regard to complex. I think
that
> the following covers it as far as the definition goes. Not tested
thoroughly

Oops nearly... I think following does the job( required
complex,Op,value_type and value_type,Op,complex too)

>
> regards
> Andy Little
>
> ----------------------------------
#ifndef GENERIC_COMPLEX_BINARY_OPERATION_HPP_INCLUDED
#define GENERIC_COMPLEX_BINARY_OPERATION_HPP_INCLUDED

#include "boost/pqs/meta/binary_operation.hpp"
#include <complex>

namespace boost{namespace pqs{ namespace meta{

    template<
        typename Value_typeL,
        template <typename> class Op,
        typename Value_typeR
>
    struct binary_operation<
        typename std::complex<
           Value_typeL
>,
        Op,
        typename std::complex<
          Value_typeR
>
>{
        typedef typename std::complex<
            typename binary_operation<
                Value_typeL,
                Op,
                Value_typeR
>::result_type
> result_type;
    };

    template<
        typename Value_typeL,
        template <typename> class Op,
        typename Value_typeR
>
    struct binary_operation<
        typename std::complex<
           Value_typeL
>,
        Op,
        Value_typeR
>{
        typedef typename std::complex<
            typename binary_operation<
                Value_typeL,
                Op,
                Value_typeR
>::result_type
> result_type;
    };

    template<
        typename Value_typeL,
        template <typename> class Op,
        typename Value_typeR
>
    struct binary_operation<
        Value_typeL,
        Op,
        typename std::complex<
          Value_typeR
>
>{
        typedef typename std::complex<
            typename binary_operation<
                Value_typeL,
                Op,
                Value_typeR
>::result_type
> result_type;
    };

}}}//boost::pqs::meta

#endif


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