#ifndef _NTPM_AI_SQUARE_H
#define _NTPM_AI_SQUARE_H

#include <arithmetic_iterators/ai_unary.h>

namespace NTPMai {

template <class _Tp>
struct squareop : public unary_function<_Tp,_Tp>
{
    _Tp operator()(const _Tp &x) const { return x*x; }
};

// handles squaring of simple promises. returns a simple promise.
template <class T_IT>
inline typename UNOP_Deffer<Promise<T_IT>,squareop<typename Promise<T_IT>::value_type> >::V
square(Promise<T_IT> p)
{
    return make_unary_op_promise(p, squareop<Promise<T_IT>::value_type>());
}


}

#endif // _NTPM_AI_SQUARE_H
