$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-02-23 12:15:35
Would it be possible to add function c_str() into format interface?
It would return const char/wchar_t* to internal string buffer.
Use cases for such function:
1.
void foo(const char*) { ...}
format f("...")
f % ...
foo(f.c_str());
This is shorter and faster than
foo(f.str().c_str());
No temporary gets created.
2.
// class used to accept any string type
struct parm_string {
parm_string(const char* s) : str_(s) {}
parm_string(const std::string& s) : str_(s.c_str()) {}
const char* str_;
};
void foo(parm_string) { ... }
format f("...")
f % ...
// ERROR - pointer to deleted temporary gets used inside foo()
foo(f.str());
foo(f.c_str()); // would be OK
/Pavel