Reference tuple from json (#5016)
* Add reference handling to tuples Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * Remove template template type because pair isn't working Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * amalgamate std::tie changes Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * allow the elation of a move by removing the ref requirement Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * force all number_xxx_t to be interchangeable Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * Finally got amalgamate to work correctly Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * remove const version, add a test case for scrambled number representations. Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> * Use the logical set of requirements instead of decltype because VS 2015 doesn't like it Signed-off-by: Evelyn LePain <ava.lepain@gmail.com> --------- Signed-off-by: Evelyn LePain <ava.lepain@gmail.com>
This commit is contained in:
1 parent
deb4c4f69f
commit
25f48639c7
5 files changed
+291
-12
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
namespace detail
|
||||
{
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_or_impl : std::integral_constant < bool, (Booleans || ...) > {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_and_impl : std::integral_constant < bool, (Booleans &&...) > {};
|
||||
|
||||
#else
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_or_impl : std::false_type {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_or_impl<true, Booleans...> : std::true_type {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_or_impl<false, Booleans...> : cxpr_or_impl<Booleans...> {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_and_impl : std::true_type {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_and_impl<true, Booleans...> : cxpr_and_impl<Booleans...> {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_and_impl<false, Booleans...> : std::false_type {};
|
||||
|
||||
#endif
|
||||
|
||||
template<class Boolean>
|
||||
struct cxpr_not : std::integral_constant < bool, !Boolean::value > {};
|
||||
|
||||
template<class... Booleans>
|
||||
struct cxpr_or : cxpr_or_impl<Booleans::value...> {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_or_c : cxpr_or_impl<Booleans...> {};
|
||||
|
||||
template<class... Booleans>
|
||||
struct cxpr_and : cxpr_and_impl<Booleans::value...> {};
|
||||
|
||||
template<bool... Booleans>
|
||||
struct cxpr_and_c : cxpr_and_impl<Booleans...> {};
|
||||
|
||||
} // namespace detail
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
Reference in new issue
Block a user