Hi,
I am get compilation error when using gcc 3.4 on i386 platform related to template :
ERROR MESSAGE:
include/template:168: error: ISO C++ forbids declaration of `result_type' with no type
include/template:168: error: expected `;' before "operator"
/include/template:171: error: expected `;' before "protected"
SOURCE FILE:
template<class _Bfn>
class binder1st
: public unary_function<typename _Bfn::second_argument_type, typename _Bfn::result_type> {
public:
binder1st(const _Bfn& _X,
const typename _Bfn::first_argument_type& _Y) : op(_X), value(_Y) {}
result_type operator()(const argument_type& _X) const // Error here ! Line 168
{return (op(value, _X)); }
protected:
_Bfn op;
typename _Bfn::first_argument_type value;
};
Everything use to run fine on gcc 3.3.x. Any suggestion to fix this issue ? Thanks
Best Regards
Kelvin Lim
3 2597
Hi,
I am get compilation error when using gcc 3.4 on i386 platform related to template :
ERROR MESSAGE:
include/template:168: error: ISO C++ forbids declaration of `result_type' with no type
include/template:168: error: expected `;' before "operator"
/include/template:171: error: expected `;' before "protected"
SOURCE FILE:
template<class _Bfn>
class binder1st
: public unary_function<typename _Bfn::second_argument_type, typename _Bfn::result_type> {
public:
binder1st(const _Bfn& _X,
const typename _Bfn::first_argument_type& _Y) : op(_X), value(_Y) {}
result_type operator()(const argument_type& _X) const // Error here ! Line 168
{return (op(value, _X)); }
protected:
_Bfn op;
typename _Bfn::first_argument_type value;
};
Everything use to run fine on gcc 3.3.x. Any suggestion to fix this issue ? Thanks
Best Regards
Kelvin Lim
Hi
Can you post some more code where the error is occuring?
Do post with code tags
Raghuram
Hi,
Here it is :
template<class _A, class _R>
struct unary_function {
typedef _A argument_type;
typedef _R result_type;
};
template<class _Bfn>
class binder1st : public unary_function<typename _Bfn::second_argument_type, typename _Bfn::result_type>
{
public:
binder1st(const _Bfn& _X, const typename _Bfn::first_argument_type& _Y) : op(_X), value(_Y) {} result_type operator()(const argument_type& _X) const
{return (op(value, _X)); }
protected:
_Bfn op;
typename _Bfn::first_argument_type value;
};
int main()
{
}
COMPILATION ERROR :
main.cpp:15: error: ISO C++ forbids declaration of `result_type' with no type
main.cpp:15: error: expected `;' before "operator"
main.cpp:17: error: expected `;' before "protected"
Thanks :)
This compiles without error using Visual Studio.NET 2005.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Emmanuel Deloget |
last post by:
Hello,
I'm trying to find a (sfinae powered) way to verify if a particular
type declares a subtype (either using typedef or by declaring a
subclass). To be more concrete, let's say that I'm...
|
by: curious2007 |
last post by:
I have the following program:
#include "Vector.cpp"
#include <iostream>
using namespace std;
template<class Arg1, class Arg2, class Result>
struct binary_function
|
by: samsneelam |
last post by:
Hi..
This is samuel, while doing a program, i encountered this problem.. Let me give you clarity regarding my prob..
I am having two files .. one is mpcplib.h it contains the follwing...
|
by: tvnaidu |
last post by:
I am using Three pthread functions below, I got ISO error, then I declared int variable called val123, then I assigned, but still I am getting error, any idea?. also I included pthread.h. compiling...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |