#include <concepts>
#include <utility>
class clazz_with_protected_ctor {
protected:
explicit clazz_with_protected_ctor(int) {}
};
template <typename T>
struct clazz_wrapper: private T {
template <typename... Ts>
requires(std::constructible_from<T, Ts&&...>) explicit clazz_wrapper(Ts&&... args) : T(std::forward<T>(args)...) {}
};
void foo() {
// Generates compile-error since the constraint for the constructor can't see the protected constructor
auto my_wrapper = clazz_wrapper<clazz_with_protected_ctor>(1);
}
I wonder if not the above code should actually be a sensible piece of code (especially with CRTP-based API:s), and it may be needed that constraints are evaluated from the context that they are used.