#include <iostream>
#include <array>
#include <type_traits>

template<typename F>
struct length;

template<typename F , std::size_t N = length<F>::value>
class Algorithm
{
public:
    Algorithm( F f )
    {}

    void execute();

private:
    F _f;
};

template<typename F , std::size_t N>
void Algorithm<F,N>::execute()
{
    _f();
}

struct Curve
{
	Curve() = default;
	Curve( const Curve& ) = default;
	
    std::array<double,3> operator()() const;
};

std::array<double,3> Curve::operator()() const
{
	return {{ 1.0f , 2.0f , 3.0f }};
}

template<>
struct length<Curve> : public std::integral_constant<std::size_t,3>
{};

template<typename F>
Algorithm<F> make_algorithm( F f )
{
	return { f };
}


int main()
{	
	Algorithm<Curve> alg{ Curve{} }; //C++98/03 style
    auto alg2 = make_algorithm( Curve{} ); //C++11 style
}

