[Trilinos-Users] Teuchos::RCP behavior

Villa Andrea (RSE) Andrea.Villa at rse-web.it
Fri May 10 07:15:41 MDT 2013


I've implemented a very simple test code:

void assign(Teuchos::RCP<UInt> & P)
{
  UInt i = 4;
  P = Teuchos::rcpFromRef(i);
  cout << *P << endl;
}

int main(int argc, char *argv[])
{
  Teuchos::RCP<UInt> P;
  assign(P);
  
  cout << *P << endl;
  cout << "count: " << P.total_count() << endl;
}

I think that this is a non-correct usage of the RCP class, since a temporary reference is passed to P. In fact I get the following output:

4
0
count: 1

However even I have built Trilinos using 
-D Teuchos_ENABLE_DEBUG:BOOL=ON \
-D Teuchos_ENABLE_DEBUG_RCP_NODE_TRACING:BOOL=ON \
no exception is thrown. Am I missing something?

Thank you very much. 
Andrea Villa.

RSE SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, in forza del quale l'assunzione di obbligazioni da parte della Società avviene con firma di un procuratore, munito di idonei poteri.
RSE adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). According to this RSE Compliance Programme, any commitment of RSE is taken by the signature of one Representative granted by a proper Power of Attorney. Le informazioni contenute in questo messaggio di posta elettronica sono riservate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o forma. Qualora Lei non fosse la persona destinataria del presente messaggio, La invitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazione al mittente. The information included in this e-mail and any attachments are confidential and may also be privileged. If you are not the correct recipient, you are kindly requested to notify the sender immediately, to cancel it and not to disclose the contents to any other person.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20130510/da09a0ce/attachment.html 


More information about the Trilinos-Users mailing list