[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function pointer
From: |
puzzlecracker |
Subject: |
Re: function pointer |
Date: |
Thu, 21 Aug 2008 05:57:43 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Aug 21, 7:32 am, Ali <ali.baha...@gmail.com> wrote:
> 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 athttp://xsc.debut 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;
>
> }
>
>
What's the definition of operator+? Also, provide more details on
namespace cxsc.