std::auto_ptr issue

std::auto_ptr issue

Portrait de Community Admin

Hi,

I'm using the following snippet of code:
typedef std::auto_ptr PRC; // pointer to results cache when I am defining a class.

later I try to do the following:

n = NEU::PRC(new NEU::results_cache);
e = NEU::PRC(new NEU::results_cache);

where n and e are defined as:
// the node cache
NEU::PRC n;

// the element cache
NEU::PRC e;


on compilation I get the following error message
FNO2OP2.h(81): error: no operator "=" matches these operands
operand types are: NEU::PRC = NEU::PRC
n = NEU::PRC(new NEU::results_cache);


My question: I thought std C++ supports the assignment operator between auto_ptr's ??
does this not work with the intel compiler ?

now having said that, the following works.
//n = NEU::PRC(new NEU::results_cache);
NEU::PRC temp1(new NEU::results_cache);
n = temp1;


weird.





8 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de murphsp1

I am also getting a similar error. Has anyone from Intel seen this post?

Portrait de cp_jain

Please check whether following code works with your configuration/compiler -

#include
#include

using namespace std;

int main()
{
typedef std::auto_ptr PRC;

PRC n;
// PRC e;

n = PRC(new string);
// e = PRC(new string);

return 0;
}


Which version of Intel compiler are you using?

Regards,
CP

Portrait de murphsp1

I tried to compile that piece of code with icc v7.1 and received the following error:

icc test.cpp
test.cpp(13): error: no operator "=" matches these operands
operand types are: PRC = PRC
n = PRC(new string);

Portrait de murphsp1

I did however get this test.cpp code to successfully compile with gcc 3.3.

Portrait de cp_jain

This test works for me with latest Intel compiler -
Version 7.1 Build 20030507Z (l_cc_pc_7.1.015-INT).

[jain@jaffa jain]$ icpc test.cpp
[jain@jaffa jain]$ ./a.out

"icpc -V or icid" will tell you which build of Intel
compiler you are using.

CP


Portrait de murphsp1

The version of icc you mention does not appear to be available for download. What did you have to do to get a hold of it?

Portrait de cp_jain

I think you will need to register yourself at Intel's premier site - http://premier.intel.com to get
latest compiler builds.

Connectez-vous pour laisser un commentaire.