$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Samuel Krempp (krempp_at_[hidden])
Date: 2004-01-25 13:36:21
le Sunday 25 January 2004 17:33, john_at_[hidden] écrivit :
>> > std::string trim(const std::string & s)
>> > {
>> > static const boost::regex e("\\A\\s+|\\s+\\z");
>> > return regex_replace(s, e, "");
>> > }
> static const boost::regex e("\\A\\s+|\\s+\\z");
> std::string trim(const std::string & s)
> {
> return regex_replace(s, e, "");
> }
>
> and then that is thread safe, albeit less elegant.
with the previous static-inside function solution, we can insure proper
initialization before threads are run by calling the function from a static
global variable, right ?
static const std::string initialisation_guaranty_dummy(trim(" "));
it's not more elegant, but at least there would be no possible problem when
other global static data calls trim() at startup.
-- Samuel