65_Pragma(
"GCC diagnostic ignored \"-Woverloaded-virtual\"")
81 using DataCapPredicate = Variant<DataValues>::Predicate;
97 template<
typename TAR>
98 struct GenNodeAccessor
102 template<
typename TY>
103 struct allow_Conversion
104 : __and_<is_constructible<TAR, TY const&>
105 ,__not_<is_narrowingInit<typename Strip<TY>::TypePlain
106 ,typename Strip<TAR>::TypePlain>>
110 using SupportedSourceTypes = Filter<DataValues::List, allow_Conversion>::List;
117 char buffer[
sizeof(TAR)];
120 template<
typename TY,
class BA>
125 handle(TY
const& srcElm)
127 new(&(BA::buffer)) TAR{srcElm};
133 using ConversionBuffer = InstantiateChained< SupportedSourceTypes
138 ConversionBuffer converter_;
141 accessTargetElement()
143 return *
reinterpret_cast<TAR*
> (&converter_.buffer);
148 GenNodeAccessor (GenNode
const& node)
151 if (not node.data.accept (converter_))
153 +
"» element from " +
string(node)
154 ,error::LUMIERA_ERROR_WRONG_TYPE);
160 accessTargetElement().~TAR();
166 return accessTargetElement();
192 template<
typename...TYPES>
193 struct ElementExtractor<
lib::diff::Rec, std::tuple<TYPES...>>
196 using TargetType = Pick<Types<TYPES...>, i>
::Type;
204 operator TargetType<i> ()
208 if (values.childSize() <= i)
209 throw error::Logic (
"Attempt to init the " + toString(
sizeof...(TYPES))
210 +
" element " + util::typeStr<std::tuple<TYPES...>>()
211 +
" from an Rec<GenNode> with only " + toString(values.childSize())
212 +
" child elements: " + toString(values)
213 ,error::LUMIERA_ERROR_WRONG_TYPE);
215 return GenNodeAccessor<TargetType<i>> (values.child(i));
meta::Types< int,int64_t,short,char,bool,double,string,time::Time,time::Offset,time::Duration,time::TimeSpan,hash::LuidH,RecRef,Rec > DataValues