Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-01-31 08:31:17


Hi,
    Following preliminary ok of "pow" mpl metafunction by Alexey
Gurtovoy... Here are some basic headers for mpl functions pow_, root_ and
reciprocal.

useage:
    boost::mpl::pow_<type,exponent>::type
    boost::mpl::root_<type,exponent>::type
    boost::mpl::reciprocal<type>::type

Obvious type for the type and exponent is a static_rational type. For pow_
param order is same as runtime std::pow(x,y) , "root_" follows logically
from pow_ .... but obviously ... pow_ could do the job) reciprocal also
useful to represent 1/ type. I don't know enough mpl yet to provide
generic examples except using the pqs types. If anyone else wants to have a
go...? And of course docs :-) . Otherwise will get on with it asap.

Feedback welcome.

regards
Andy Little
----------------------------------------------------------------
headers:

#ifndef BOOST_MPL_POW_HPP_INCLUDED
#define BOOST_MPL_POW_HPP_INCLUDED

namespace boost { namespace mpl{

    template <typename Type, typename Power>
    struct pow_ {
        typedef implementation_defined type
   };

}} //boost::mpl

#endif

//-----------------
#ifndef BOOST_MPL_ROOT_HPP_INCLUDED
#define BOOST_MPL_ROOT_HPP_INCLUDED

namespace boost { namespace mpl{

    template <typename Type, typename Power>
    struct root_ {
        typedef implementation_defined type;
   };

}} //boost::mpl

#endif
//-----------------------------------

#ifndef BOOST_MPL_RECIPROCAL_HPP_INCLUDED
#define BOOST_MPL_RECIPROCAL_HPP_INCLUDED

namespace boost { namespace mpl{

    template <typename Type>
    struct reciprocal{
        typedef implementation_defined type;
   };

}} //boost::mpl

#endif


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