home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,913 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to Seungbeom Kim   
   Re: Passing pointer to member objects   
   11 Mar 13 09:37:50   
   
   From: daniel.kruegler@googlemail.com   
      
   On 2013-03-11 09:39, Seungbeom Kim wrote:   
   >> Well I could but how many functions do I need since the size of the   
   >> array must be specified in the function signature?   
   >>   
   >> Is there any way to generically define this function so I can pass   
   >> any structure member including char arrays of arbitrary length?   
   >   
   > As Daniel Krügler suggested, you can use templates. Let me add that   
   > comparing built-in arrays by a simple == doesn't work and that you'll   
   > probably want to use std::strcmp.   
      
   Yes, you are right, I missed the last point. In this case it would still   
   be possible to stick with a single function template, when we replace   
   the direct comparison code by another template function call that is   
   specialized for pointers and/or arrays.   
      
   Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca