Boost logo

Boost Users :

From: Jim Lear (jim.lear_at_[hidden])
Date: 2005-02-11 14:14:11


So, I assume the '...' paramater, a la printf, is all but forbidden.  It's too bad there no good way to pass a variable number of arguments in C++.  Of course one could pass a vector of std::string references, but I'm beyond my feeble abilities to understand the performance affects of constructing a temporary vector.

t. scott urban wrote:
On Fri, 2005-02-11 at 10:39 -0600, Jim Lear wrote:
  
No, fastcat does not exist.  I'm suggesting that it may be easier for
Chateauneu to create an optimized method (fastcat or such) that
accepts multiple operands rather than wrestling with operators that
accept only two operands. 
    

You're probably right.  You could do something like.

using std::string
void fastcat (string & dest, const string & s1);
void fastcat (string & dest, const string & s1, const string & s2);
etc

Explicit unrolling of the loops in my toy concat class.  Unless you only
have a few cases you care about, this is tedious.

It's probably to use some template machinery and or preprocessor magic
to create a form that takes an arbitrary (up to some limit) number of
strings to concatenate. 

Another option is to rely on the compilers intimate knowledge of it's
own library implementations to do all this for you.  Don't know of real
compilers do this, but it seems like a reasonable request.

  

-- 
Jim Lear
(512) 228-5532 (work)
(512) 293-7248 (cell)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net