help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

function pointer


From: Ali
Subject: function pointer
Date: Thu, 21 Aug 2008 04:32:54 -0700 (PDT)
User-agent: G2/1.0

This code below works with M$ VS2005 but fails with g++ 4.1.3.
However, the unary operation  works with g++ as well.

The interval class is at http://xsc.de but everything is declared as
it should be.

The error message of g++ is:

main.cpp:9: error: no matches converting function ‘operator+’ to type
‘class cxsc::interval (*)(const class cxsc::interval&, const class
cxsc::interval&)’
[...]
candidates are: cxsc::interval cxsc::operator+(const cxsc::interval&,
const cxsc::interval&)

-------------------------------------------------------------------------------------
#include "interval.hpp"
using namespace cxsc;

int main() {

        typedef interval (*bin_op) (const interval&, const interval&);

        bin_op Add;
        Add = operator+;

        typedef interval (*un_op) (const interval& );

        un_op Exp;
        Exp = exp;


        return 0;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]