[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

[c++] midlertidig / flygtig struct



Kan jeg oprette og initialisere en struct uden at oprette en (navngiven) variabel, når structen blot skal anvendes direkte isom funktionsargument?

Eksempel:


Jeg har: ------------- typedef struct{ int id; int value; } valpair; list<valpair> mylist; --------------


Hvis jeg blot skal indsætte et 'valpair' synes jeg det er overkill at skulle: ----------------- struct valpair tmpvalpair; tmpvalpair.id = 7; tmpvalpair.value = 47; mylist.push_back( tmpvalpair ) -----------------


Kan man gøre noget a la: ------------------ mylist.push_back( { 7, 47 } );

eller

mylist.push_back( { id=7, value=47 } );


???

/ Kristian

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *