Opened 6 years ago
Closed 5 years ago
#12776 closed Feature Requests (wontfix)
Add c_str free function to Boost::Format
| Reported by: | Owned by: | James E. King, III | |
|---|---|---|---|
| Milestone: | Boost 1.66.0 | Component: | format |
| Version: | Boost 1.61.0 | Severity: | Optimization |
| Keywords: | Cc: |
Description
A c_str function that returns a pointer to a new copy of the formatted string would be useful to use Boost::Format to create C-style strings.
Simply calling str(fmt).c_str() is insufficient since this returns a pointer to a temporary.
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
| Owner: | changed from to |
|---|---|
| Severity: | Problem → Optimization |
As a pattern in the standard template library that already exists, c_str() returns a pointer that is only valid for the lifetime of the object from which it was derived, and may be invalidated by mutations of that object. I see little value in encouraging the use of naked pointers here or in overriding the meaning of c_str.
comment:3 by , 5 years ago
| Milestone: | To Be Determined → Boost 1.66.0 |
|---|---|
| Resolution: | → wontfix |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

Where would this new copy be stored?