You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder myself why we have the following code (and why its so magic :-D)
template <classT>
structabstract_type {
structis_not_bound {
operator T*() const {
using constraint_not_satisfied = is_not_bound;
return constraint_not_satisfied{}.error();
}
// clang-format offstaticinline T*
error(_ = "type is not bound, did you forget to add: 'di::bind<interface>.to<implementation>()'?");
// clang-format on
};
template <classTName>
structnamed {
structis_not_bound {
operator T*() const {
using constraint_not_satisfied = is_not_bound;
return constraint_not_satisfied{}.error();
}
// clang-format offstaticinline T*
error(_ = "type is not bound, did you forget to add: 'di::bind<interface>.named(name).to<implementation>()'?");
// clang-format on
};
};
};
How about replacing with a static_assert?
template <classT>
structabstract_type {
structis_not_bound {
static_assert(T::_, "type is not bound, did you forget to add: 'di::bind<interface>.to<implementation>()'?");
};
template <classTName>
structnamed {
structis_not_bound {
static_assert(T::_ || TName::_, "type is not bound, did you forget to add: 'di::bind<interface>.named(name).to<implementation>()'?"));
};
};
};
The text was updated successfully, but these errors were encountered:
Expected Behavior
See "detailed" not_bound errors
Actual Behavior
See nothing, only a linker error
gcc 12.2
clang 15
similar to:
#458
Question
I wonder myself why we have the following code (and why its so magic :-D)
How about replacing with a
static_assert
?The text was updated successfully, but these errors were encountered: