I have the following program:
#include "Vector.cpp "
#include <iostream>
using namespace std;
template<class Arg1, class Arg2, class Result>
struct binary_function
{
typedef Arg1 first_argument_ type;
typedef Arg2 second_argument _type;
typedef Result result_type;
};
template <class Type> class Average : std::binary_fun ction<Type, Type, Type>
{
public:
result_type operator() (first_argument _type a, second_argument _type b)
{ return (a+b)*0.5;}
};
However, it gives me the following error:
ISO C++ forbids declaration of `result_type' with no type
About line
result_type operator() (first_argument _type a, second_argument _type b)
Replacing this line with
typename result_type operator() (first_argument _type a, second_argument _type b)
did not solve the problem.
#include "Vector.cpp "
#include <iostream>
using namespace std;
template<class Arg1, class Arg2, class Result>
struct binary_function
{
typedef Arg1 first_argument_ type;
typedef Arg2 second_argument _type;
typedef Result result_type;
};
template <class Type> class Average : std::binary_fun ction<Type, Type, Type>
{
public:
result_type operator() (first_argument _type a, second_argument _type b)
{ return (a+b)*0.5;}
};
However, it gives me the following error:
ISO C++ forbids declaration of `result_type' with no type
About line
result_type operator() (first_argument _type a, second_argument _type b)
Replacing this line with
typename result_type operator() (first_argument _type a, second_argument _type b)
did not solve the problem.
Comment