boostorg / json

A C++11 library for parsing and serializing JSON to and from a DOM container in memory.
https://boost.org/libs/json
Boost Software License 1.0
424 stars 94 forks source link

Small help for non eagle eyed people #976

Closed RoyBellingan closed 5 months ago

RoyBellingan commented 5 months ago

In

https://github.com/boostorg/json/blob/db92f8c22360990f450fe27b86ea1a5830b5cf05/include/boost/json/detail/value_to.hpp#L404

Is possible to add

static_assert(std::is_default_constructible<T>::value, "The destination type must be default constructible");

As the error generated contains quite a lot of cruft ? And this should help a bit.

grisumbras commented 5 months ago

Alternatively, I should have made default constructibility a requirement for is_described_class.

grisumbras commented 5 months ago

Actually, no, I should indeed use a static assert.