31#include <unordered_map>
50template <
typename T,
typename =
void>
54template <PrimitiveStorage T>
100template <
typename T, std::
size_t N>
129template <
typename... Ts>
156template <std::
size_t N>
157struct cell_arg<char[N]> {
159 using type = std::string;
161template <std::
size_t N>
162struct cell_arg<const char[N]> {
164 using type = std::string;
167struct cell_arg<char*> {
168 using type = std::string;
171struct cell_arg<const char*> {
172 using type = std::string;
176using cell_arg_t =
typename cell_arg<std::remove_cvref_t<T>>::type;
191 requires HasDefaultCellWrapper<detail::cell_arg_t<T>>
194 return Cell::of(std::forward<T>(v));
209template <
typename... Ts>
210 requires(HasDefaultCellWrapper<detail::cell_arg_t<Ts>> && ...)
211[[nodiscard]] std::shared_ptr<ListCell>
make_list(Ts&&... xs) {
212 std::vector<cell_t> elems;
213 elems.reserve(
sizeof...(Ts));
214 (elems.push_back(
cell(std::forward<Ts>(xs))), ...);
230[[nodiscard]]
inline std::shared_ptr<MapCell>
231make_map(
const std::initializer_list<std::pair<const std::string, cell_t>> entries) {
232 std::map<std::string, cell_t> data(entries.begin(), entries.end());
269#define PARCEL_DEFAULT_CELL(CellT) \
271 struct parcel::default_cell_for<typename CellT::storage_t> { \
272 using type = CellT; \
Leaf cell wrapping a single scalar (or complex) value of type T.
Definition primitive.h:316
Homogeneous list of element cells of type T.
Definition list.h:106
Homogeneous string-keyed map of values of type T.
Definition map.h:106
Closed-set polymorphic cell — exactly one of Ts at runtime.
Definition union.h:100
Concept matching types for which a default_cell_for mapping exists.
Definition defaults.h:69
std::shared_ptr< MapCell > make_map(const std::initializer_list< std::pair< const std::string, cell_t > > entries)
Build a heterogeneous MapCell from a brace list of {key, cell} pairs.
Definition defaults.h:231
default_cell_for< T >::type default_cell_for_t
Convenience alias for default_cell_for<T>::type.
Definition defaults.h:61
std::shared_ptr< ListCell > make_list(Ts &&... xs)
Build a heterogeneous ListCell from raw values, wrapping each via parcel::cell(......
Definition defaults.h:211
auto cell(T &&v)
Wrap a raw value into its default cell, returning a shared_ptr to the cell.
Definition defaults.h:192
TypedListCell<T> and heterogeneous ListCell with their descriptors.
TypedMapCell<T> and heterogeneous MapCell with their descriptors.
PrimitiveCell<T> plus the per-storage PrimitiveTraits<T> specializations.
static std::shared_ptr< ListCell > of(Args &&... args)
Construct a shared_ptr<Derived> forwarding the arguments.
Definition cell.h:385
Maps a raw field type to its default ICell wrapper.
Definition defaults.h:51
UnionCell<Ts...> closed-set polymorphic cell and its descriptor.