[Trilinos-Users] [EXTERNAL] Can not allocate Teuchos::RCP with new
Bartlett, Roscoe A
rabartl at sandia.gov
Fri Jul 28 11:17:41 EDT 2017
There is no implicit conversion from a raw pointer to a smart pointer (that would be a very bad idea).
Please use Teuchos::rcp():
https://trilinos.org/docs/dev/packages/teuchos/doc/html/classTeuchos_1_1RCP.html#details
You might find the Teuchos::RCP beginner’s guide helpful as well:
https://trilinos.org/docs/dev/packages/teuchos/doc/html/RefCountPtrBeginnersGuideSAND.pdf
-Ross
From: Trilinos-Users [mailto:trilinos-users-bounces at trilinos.org] On Behalf Of ztdepyahoo
Sent: Friday, July 28, 2017 3:29 AM
To: trilinos-users <trilinos-users at trilinos.org>
Subject: [EXTERNAL] [Trilinos-Users] Can not allocate Teuchos::RCP with new
Dear group:
I want to use "new" to allocate for RCP pointer as shown in the following code, but it gives me the following message. It seems RCP can not be created from a " new".
So how to resolve this problems?
class DistributionVector
{
pubulic:
DistributionVector()
{
Map=new Epetra_Map(-1,MyElements,MyGlobalElementsID.Values(),0,Comm);
}
private:
Teuchos::RCP<Epetra_Map> Map;
};
Error mesage:
/home/ztdep/Projects/PFlowingHeat3D/Mesh/Field.cpp:46:7: error: no match for ‘operator=’ (operand types are ‘Teuchos::RCP<Epetra_Map>’ and ‘Epetra_Map*’)
Map=new Epetra_Map(-1,MyElements,MyGlobalElementsID.Values(),0,Comm);
Regards
________________________________
ztdepyahoo at gmail.com<mailto:ztdepyahoo at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170728/de9f7f27/attachment.html>
More information about the Trilinos-Users
mailing list