This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] include <bits/functexcept.h> in <variant>
- From: Tim Shen <timshen at google dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 14 Oct 2016 03:05:44 -0700
- Subject: Re: [Patch] include <bits/functexcept.h> in <variant>
- Authentication-results: sourceware.org; auth=none
- References: <CAG4ZjN=zXRQwDXYQt=PnwVu9pPUDQ67Kdaqgf+kro+3Eh-rPZw@mail.gmail.com> <20161014093115.GD2922@redhat.com>
On Fri, Oct 14, 2016 at 2:31 AM, Jonathan Wakely wrote:
> Yes, that's right. OK for trunk, thanks.
Committed.
> By the way, I'm intending to add __throw_bad_variant_access_fmt to
> bits/functexcept.h and make it use __snprintf_lite() so that we can
> do:
>
> __throw_bad_variant_access_fmt("cannot access alternative %zu "
> "of std::variant because index() is %zu", _Np, __v.index());
>
> (Thanks to Nico Josuttis for the suggestion).
>
It's great to be able to print runtime indices in an exception
message! I could have used this for std::regex exceptions too.
--
Regards,
Tim Shen