[ create a new paste ] login | about

Link: http://codepad.org/rehcOxYR    [ raw code | fork ]

C++, pasted on Jun 27:
namespace strategy { namespace distance { namespace services 
{

template <typename Point1, typename Point2, typename typename CalculationType, typename P1, typename P2>
struct similar_type<strategy::distance::pythagoras<Point1, Point2, CalculationType>, P1, P2>
{
    typedef strategy::distance::pythagoras<P1, P2, CalculationType> type;
};


template <typename Point1, typename Point2, typename typename CalculationType, typename P1, typename P2>
struct get_similar<strategy::distance::pythagoras<Point1, Point2, CalculationType>, P1, P2>
{
private :
    typedef strategy::distance::pythagoras<Point1, Point2, CalculationType> this_type;
public :
    static inline typename similar_type<this_type, P1, P2>::type apply(this_type const& input)
    {
        return strategy::distance::pythagoras<P1, P2, CalculationType>();
    }
};

template <typename Point1, typename Point2, typename typename CalculationType>
struct comparable_type<strategy::distance::pythagoras<Point1, Point2, CalculationType> >
{
    typedef strategy::distance::comparable::pythagoras<Point1, Point2, CalculationType> type;
};


template <typename Point1, typename Point2, typename typename CalculationType>
struct get_comparable<strategy::distance::pythagoras<Point1, Point2, CalculationType> >
{
private :
    typedef strategy::distance::pythagoras<Point1, Point2, CalculationType> this_type;
    typedef strategy::distance::comparable::pythagoras<Point1, Point2, CalculationType> comparable_type;
public :
    static inline comparable_type apply(this_type const& input)
    {
        return comparable_type();
    }
};

template <typename Point1, typename Point2, typename typename CalculationType>
struct result_from_distance<strategy::distance::pythagoras<Point1, Point2, CalculationType> >
{
private :
    typedef strategy::distance::pythagoras<Point1, Point2, CalculationType> this_type;
public :
    template <typename T>
    static inline typename this_type::return_type apply(T const& value)
    {
        return  typename this_type::return_type(value);
    }
};


Create a new paste based on this one


Comments: