runtime::invoke
functions with void return type #68 (thanks @ohanar)trait::get_t
- speeds up compilation for large classes #72, see discussion in #71refl::util::filter()
and its users #65 (thanks @RalphSteinhagen)for_each
and (has|get)_(reader|writer)
c197d35 and #60get_display_name_const
on MSVC #53 (thanks @rpatters1)NOTE: This version does not contain any breaking changes at the source level (as is clear by the patch version increment). However, this version adds CMake support and this required the
refl.hpp
source file to be moved to a standard locationinclude/refl.hpp
. If you are consuming refl-cpp as a single-header library, you can continue to do so.
refl::runtime::debug
implementation for basic_string_view
(93351ac)refl::runtime::detail::next_depth
#36 (by oberrich)std::complex
support metadata. Disable with REFL_NO_STD_COMPLEX
.refl::descriptor::get_reader
/get_writer
utilities for getter/setter properties.refl::trait::index_of
for finding index of type in a type_list
.refl::descriptor::get_display_name_const
as const_string
alternative to get_display_name
.refl::type_descriptor::declared_bases
lists base types declared via the bases<...>
attributerefl::type_descriptor::bases
lists base types declared via the bases<...>
attribute as well as inherited membersrefl::type_descriptor::members
now includes declared and inherited members (when base types are specified via bases<...>
attribute)refl::type_descriptor::declared_members
preserves the old behaviorrefl::attr::bases<...>
types are now validated (via std::is_base_of
)refl::descriptor::get_simple_name
, which strips namespace and template declarations from the type name (std::vector<int>
-> vector
)_descriptor
types for symmetry purposes (and might allow for more optimal implementation in the future)refl::const_string::find/rfind
for searching chars in const_stringsrefl::make_const_string(char)
overloadrefl::type_list<T>
specialization which exposes typedef T type
and a synonym refl::type_tag<T>
refl::trait::concat
now support an arbitrary number of type_list
s as type argumentsrefl::trait::as_tuple
(similar to as_type_list
but for std::tuple
)refl::trait::reverse
refl::util::reflect_types
/refl::util::unreflect_types
to quickly create a list of type_descriptor
s from a list of types and then backstd::basic_ostream
in attr::debug
and util::debug
(up to the user to take advantage of)std::string_view
descriptor::
utilitiestrait::
types (should lead to better compile-times)refl::util::identity
implementation for rvaluesoperator()/invoke
refl::util::debug
for std::tuple
#26refl::descriptor::get_bases
in favor of refl::descriptor::get_base_types
get_display_name
for properties with no friendly_name
. Example: get_display_name(get_foo) -> "foo"
std::string_view
#23type_list
do not properly take into account reference qualifiersconst_string
constructor in older versions of clangutil::filter
results list order (used to be reversed)reflect
, is_reflectable
, debug
runtime::debug
print formattingconst_string
utils #21. Suggested workaround: use predicate variantsrefl::descriptor::get_bases
for clang #19refl::descriptor::get_bases
(as well as refl::descriptor::has_bases
) to inspect a type's declared base types (see example-inheritance.cpp)refl::descriptor::get_property_info
to refl::descriptor::get_property
to match the attribute name and its trait-based counterparts.std::tuple<...>
were sometimes cv-qualified).refl::descriptor::get_display_name()
in some compilers (thanks to ticelo)[[maybe_unused]]
that caused warnings under clang.refl::const_string<N>
instances from const char*
which allows using c-strings (const char*
) values from attributes together with const_string<N>
and in constexpr
context possible. That feature is exposed by the REFL_MAKE_CONST_STRING(CString)
macro. Important: CString
must be a Core constant expression. The macro is necessary to avoid the duplication of the provided expression and currently expands to ~ detail::copy_from_unsized<detail::strlen(CString)>(CString)
. (another thanks to Siapran for contributing the implementation for the constexpr length()
function.)constexpr const_string::substr<Pos, [Count]>()
make_const_string()
as a shortcut for the creation of empty const strings.trait::{first, last, tail, init, append, prepend, reverse, concat}
and TraitName_t
equivalents to ease the use of type_list<...>
.trait::map
and trait::filter
now no longer accept variadic template parameters. Wrap variadic parameters in a type_list. (Allowing both type_list<Ts...>
and Ts...
is problematic due to cryptic errors when e.g. const type_list<Ts...>
is provided.)util::accumulate
now mimics the behaviour of std::accumulate
more closely. It relies on the return value of the functor instead of mutating the accumulator argument. The new implementation now allows for the types of initial_value
and the return type to differ (thanks to Siapran).util::get<N>(const type_list<Ts...>&)
. Use trait::get_t<N, type_list<Ts...>>
instead. This is part of a move towards minimizing the duplication between the trait::
and util::
namespaces.operator+(const_string<N>, const_string<M>)
(fixed by Siapran) #11type_descriptor<T>::type
as an alias for T
.function_descriptor<T, N>::pointer
which points to the target function, if the pointer can be resolved and to nullptr otherwise.function_descriptor<T, N>::is_resolved
for checking whether the pointer to the function has been resolved successfully.function_descriptor<T, N>::resolve<Pointer>
for explicitly resolving the function pointer as a value of the specified type.util::get<size_t N>(type_list<Ts...>&&)
which zero-initializes and returns the type at the N-th position.util::get<size_t N>(Tuple&&)
as an alias for std::get<N>
.$refl(...)
, REFL_UNSTABLE(...)
, REFL_DEPRECATED(...)
refl::attr::access_type::read, write
constants. Replaced by read_only, write_only for consistency.refl::attr::read_only, read_write, write_only
constants. Use the enum-qualified values. The constants are still available unqualified in macro context.refl::util::const_string<N>
was replaced by a user-declared default constructor which now always zero-initializes the string buffer.trait::is_type[_v]
, descriptor::is_type(const T&)
for checking whether a type is a type_descriptor<T> instance.trait::as_type_list
now supports reference type in place of T<Ts...>
(e.g. std::tuple<Ts...>&
-> type_list<Ts...>
).refl::attr::access_type::{read, write}
now deprecated, replaced by {read_only, write_only}
(Note: implicitly-usable read_only
, write_only
constants in attribute (in REFL_...
macros) context remain unchanged)refl::descriptor::field_descriptor::operator()
now supports acting as a setter. refl::descriptor::make_invoker
is now no longer needed and marked as deprecated.trait::filter
to trait::filter_t
, replaced by struct trait::filter { typedef ... type; }
to follow preset conventiontrait::map
to trait::map_t
, replaced by struct trait::map { typedef ... type; }
to follow preset conventionfunction_descriptor<...>::pointer
now no longer exists. (Reason: Replacing with forwarding function allows for more flexibility when using refl::runtime::proxy<>
. Migrate by taking a pointer to function_descriptor<...>invoke()
)std::tuple<...>
or support variadic arguments. Use type_list<>
or trait::as_type_list_t
to migrate working code. (Reason: Specializations found to be causative to many recently discovered bugs and are error-prone.)trait::skip<N>
util::to_tuple
trait::contains_base
was working the other way around (checking for presense of base of a specified type, instead of checking for a derived type with a specified base)type_info__<T*>
has name defined as char[N]
instead of const_string<N>
REFL_NO_VARIADICS
) refl::util::const_string<N>
can now be directly compared for equality with char[M]
refl::util::const_string<N>
can now be concatenated with char[M]
refl::runtime::debug
now captures values of member invocations by universal references (previous implementations required a copy of the value)refl::runtime::debug
now does not require the members of composites to be reflectable. (members that cannot be printed get replaced with <?>
).refl::trait::is_reflectable
now discards cv-qualifiers -> all cv-qualified types are now also reflectable.refl::descriptor::is_writable
now correctly supports field descriptorsrefl.hpp
is now not included when REFL_PREPROCESSOR
is defined (optimization for refl-ht)REFL(...)
macro for annotation of reflectable members (replaces $refl(...)
)$refl(...)
macro usage now deprecatedrefl::util::contains(type_list<...>, [predicate]), refl::util::contains(type_list<...>, const_string<N>)
refl::attr::is_readable/is_writable
(use refl::descriptor::is_readable/is_writable
instead; reason: lack of support for fields that lack a property attribute)refl::runtime::proxy<Derived, Target>
can now delegate field 'invocations'. (Methods with names matching those of the reflected fields are created.)refl::attr::property
now can take an optional refl::attr::access_type
(values: read_only
, write_only
, read_write
) to specify whether the property is considered readable or writable (or both).refl::descriptor::is_readable/is_writable
refl::attr::is_readable/is_writable