Commit 0c641ecf authored by Harris Hancock's avatar Harris Hancock

Expose kind<T>() in lite-mode

kind<T>() is used in the test.capnp.h generated header. MSVC accepts it,
so it probably makes more sense to expose kind<T>() in lite-mode than to
use CAPNP_KIND(T) in the generated header code.
parent 5e343000
......@@ -156,13 +156,6 @@ template <typename T> struct Kind_<T, kj::VoidSfinae<typename schemas::EnumInfo<
} // namespace _ (private)
#if CAPNP_LITE
#define CAPNP_KIND(T) ::capnp::_::Kind_<T>::kind
// Avoid constexpr methods in lite mode (MSVC is bad at constexpr).
#else // CAPNP_LITE
template <typename T, Kind k = _::Kind_<T>::kind>
inline constexpr Kind kind() {
// This overload of kind() matches types which have a Kind_ specialization.
......@@ -170,6 +163,13 @@ inline constexpr Kind kind() {
return k;
}
#if CAPNP_LITE
#define CAPNP_KIND(T) ::capnp::_::Kind_<T>::kind
// Avoid constexpr methods in lite mode (MSVC is bad at constexpr).
#else // CAPNP_LITE
#define CAPNP_KIND(T) ::capnp::kind<T>()
// Use this macro rather than kind<T>() in any code which must work in lite mode.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment