- Is there a possibility to be faster at run-time with basic_string literals?
As already stated, the string length is known and automatically passed to the constructor.
- Is my "naive" implementation totally wrong?
No, it's correct.
- Can the layout of data in ROM be different with basic_string literals, or any other difference at compile-time versus run-time?
Probably not, because the relevant basic_string
constructor is not constexpr
so won't be eligible for static initialization, so probably can't be put in ROM and has to be done at run-time.