Fix the VS2015 build of unit-json_view_positions.cpp (#5957)

VS 2015 does not accept std::string::npos in a constant expression (C2131),
and the constant is only used at run time.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann authored and GitHub committed 2026-10-28 22:08:55 +01:00
1 parent 54f6b3ef06
commit 46bead6e13
1 file changed
+2 -1
+2 -1
View File
@@ -32,7 +32,8 @@ using nlohmann::json_editable_document;
namespace
{
constexpr std::size_t npos = std::string::npos;
// not constexpr: VS 2015 does not accept std::string::npos in a constant expression (C2131)
const std::size_t npos = std::string::npos;
// whether every value of a has the source positions of the value of b at the
// same place (a and b are equal; shallow test documents only)