8 #include <ints/IntSeqInsert.hpp> 9 #include <ints/IntSeqRemove.hpp> 10 #include <metaprogramming/SFINAE.hpp> 11 #include <tens/TensClass.hpp> 12 #include <tens/TensComp.hpp> 13 #include <smet/Bind.hpp> 18 #define REL_BIND_PROTOTYPE 19 template <typename _BoundType, 20 typename _BoundToType, 38 template <
typename _BoundType,
39 typename _BoundToType,
44 public NnarySmET<RelBinder<_BoundType,_BoundToType,_Ad,_Refs...>>,
45 public ConstrainAreSmETs<_Refs...>
52 typename RemRef<Ref<0>>::Tk;
56 typename NestedTk::types;
75 static constexpr
int boundPos=
76 posOfType<_BoundType,
typename NestedTk::types>;
79 static constexpr
int boundToPos=
80 posOfType<_BoundToType,
typename NestedTk::types>;
87 AddPointerIfFunction<_Ad> adapter;
90 using absBinder=Binder<_BoundType,Ref<0>>;
95 PROVIDE_TK(
typename NestedTk::
template AllButType<BoundType>);
110 static constexpr
int extBoundToPos=
111 posOfType<_BoundToType,
typename Tk::types>;
127 template <
typename...Args,
134 const Tuple<Args...>& targs)
138 return get<0>(refs).eval(get<Head>(targs)...,
140 get<Tail>(targs)...);
150 template <
typename...Args>
156 using Head=IntsUpTo<boundPos>;
159 const auto boundToId=
160 get<extBoundToPos>(Tuple<Args...>(args...));
163 const decltype(boundToId) boundId=
169 cout<<
" evaluating rel_binder of component "<<_BoundType::name();
170 cout<<
" bound to component "<<_BoundToType::name()<<
",";
171 cout<<
" position where to read the boun-tod component: "<<extBoundToPos;
172 cout<<
" bound to component "<<_BoundToType::name();
173 cout<<
" of "<<NestedTk::nTypes<<
" types,";
174 cout<<
" boundToId: "<<boundToId;
175 cout<<
" boundId: "<<boundId;
180 RangeSeq<boundPos,1,Tk::nTypes>;
182 return relBinderInternalEval(Head{},
185 std::forward_as_tuple(args...));
195 template <
typename SMET,
196 typename=EnableIf<isSame<Unqualified<SMET>,Unqualified<Ref<0>>>>>
197 explicit RelBinder(SMET&& smet,
199 : refs(std::forward_as_tuple(smet)),adapter(forw<_Ad>(adapter))
201 #ifdef DEBUG_REL_BINDER 203 cout<<
"Constructing relative binder "<<
this<<
", bound type "<<_BoundType::name()<<
", bound to type "<<_BoundToType::name()<<endl;
210 #ifdef DEBUG_REL_BINDER 212 cout<<
"Destroying relative binder "<<
this<<endl;
227 constexpr
bool areTwinnedOfEachOther=
228 isSame<TwinCompOf<_BoundToType>,_BoundType>;
231 Conditional<areTwinnedOfEachOther,_BoundType,CompOrTwinned<_BoundType,SMET>>;
233 Conditional<areTwinnedOfEachOther,_BoundToType,CompOrTwinned<_BoundToType,SMET>>;
235 #ifdef DEBUG_REL_BINDER 237 cout<<
"Constructing a rel binder for type "<<BoundType::name()<<
" to type:"<<BoundToType::name()<<
" , storage: "<<getStor(smet)._v<<endl;
243 RelBinder<BoundType,BoundToType,decltype(adapter),SMET> b(forw<SMET>(smet),forw<_Ad>(adapter));
248 #undef REL_BIND_PROTOTYPE 251 namespace _RelBindInternalChecks
266 template <
typename T>
274 decltype(wire<
int>),T>);
#define AS_ASSIGNABLE_AS_REF(ID)
Get the same assignability of a given ref.
#define MERGED_COMPS_VIEW_OF_REF(I)
Returns the merged comps view of the I-th Ref.
#define STATIC_ASSERT_TUPLE_HAS_TYPE(T,TP)
Assert if the type T is not in the types of tuple TP.
#define PROVIDE_POS_OF_RES_TCS_IN_REFS
Provide the position of result Tk TensComp in each input.
#define STATIC_ASSERT_ARE_N_TYPES(N, UNEXP_PARPACK)
Static assert if not passing exactly N types.
#define PROVIDE_TK(...)
Provides the Tk member.
#define PROVIDE_MERGEABLE_COMPS_ACCORDING_TO_REFS_AND_EXTRA
Provide MergeableComps delimiter according to references and extra.
#define PROVIDE_SIMPLE_NNARY_COMP_SIZE
#define SFINAE_WORSEN_DEFAULT_VERSION_TEMPLATE_PARS
#define SAME_FUND_AS_REF(ID)
Get the same Fund type of a given ref.
#define PROVIDE_NNARY_GET_MERGED_COMPS_VIEW(DESCRIPTION,...)
Provides a getMergedCompsView method, taking Is as template parameter.
#define FORWARD_IS_ALIASING_TO_REFS
#define STATIC_ASSERT_IS_NNARY_SMET(...)
Defines the check for a Nnary SmET.
#define PROVIDE_EXTRA_MERGE_DELIMS(...)
Add an ExtraDelims IntSeq called ExtraDelims.
#define SFINAE_WORSEN_DEFAULT_VERSION_ARGS_CHECK
Check that no extra arg is passed.
#define NOT_STORING
Set the SmET to not-storing.
#define PROVIDE_ALSO_NON_CONST_METHOD(NAME)
#define SFINAE_WORSEN_DEFAULT_VERSION_ARGS
Provide empty list of args, used to unprioritize default version.
#define DECLAUTO
Short name for decltype(auto)
#define PROVIDE_SMET_ASSIGNEMENT_OPERATOR(UNARY_SMET)
Defines the assignement operator, calling assign.
#define PROVIDE_NNARY_SMET_REFS_AND_CHECK_ARE_N(N)
#define REL_BIND_PROTOTYPE
Define the prototype for relBind function.
#define DEFINE_BASE_TYPE(TYPE,...)
#define DEFINE_TENS_COMP(BINDER,TYPE,CONST_NAME,HMANY)