From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2019-09-14 22:13:19


On Sat, Sep 14, 2019 at 2:21 PM Roberto Hinz via Boost
<boost_at_[hidden]> wrote:
> Perhaps we could do as Vinnie said, but just name the function
> as `terminate()` instead of `c_str()`.

Would this be OK?

    template <std::size_t N>
    class static_string
    {
        mutable char buf_[N+1];
    public:
        ...
        char const*
        c_str() const noexcept
        {
            buf_[size()] = '\0';
            return buf_;
        }
    };

Or we could just leave it the way that it is, and pay for keeping the
string null terminated at all times, that's not so bad really.

Regards