[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-devtools
Subject:    Re:  HPUX-DEVTOOLS: help unary_function
From:       Dennis Handly <dhandly () cup ! hp ! com>
Date:       2004-01-08 5:35:30
Message-ID: 200401080535.VAA05840 () hpcll183 ! cup ! hp ! com
[Download RAW message or body]

>I am porting my application from Tru64 Unix to HPUX 11.11 (PA-RISC).
>Compiler is aCC of version A.03.33

The latest aC++ compiler is A.03.52.

>I have a template class "unary_test" which is derived from unary_function.

#include <functional>
template <class T>
class unary_test : public unary_function<T,void> {
  result_type operator()(argument_type value) {

>The same code works fine on Tru64 and as well as on windows.

Those compilers are broken, your source is illegal.

>What could be the problem. How to fix these errors?
- Santhi

The correct source needs these "helper" typedefs:
   typedef unary_function<T,void> base;
   typedef typename base::result_type result_type;
   typedef typename base::argument_type argument_type;

These is because the base class is dependent on the template parm.
(Another legal solution would be to use a using declaration but that
produces Error 873.)

>From: "Banibrata Dutta" <dutta@india.hp.com>
>Are you sure that the defn. of result_type is available at the point
>where you are defining the () oper??

That's the problem.  With templates the compiler can NOT look into the
a dependent base class for definitions unless you do something special,
14.6.2(3).
 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE hpux-devtools
 _________________________________________________________________
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic