[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]![]() |
![]() |
![]() |
|||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
![]() |
![]() |
![]() |
Hej Kristian. Kristian Nørgaard <sslug@sslug> wrote on 17-05-2006 14:50:14: > Kan jeg oprette og initialisere en struct uden at oprette en (navngiven) > variabel, når structen blot skal anvendes direkte isom funktionsargument? > > 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 } ); noget i stil med: list<pair<int, int> > valpair; valpair.push_back(make_pair(7, 47)); Venlig hilsen / Best regards Nils Åke Ljunggren Senior Developer Mobile +45 2613 9966 sslug@sslug IntraVision ApS Lyngsø Alle 3, 2970 Hørsholm, Denmark Office: +45 7023 2340 Fax: +45 7023 2349 www.intravision.dk
![]() |
![]() |
![]() |
||||||||||||
|
||||||||||||||
![]() | ||||||||||||||
|
||||||||||||||
![]() |
![]() |
![]() |