How to write a concept that requires one to create an object to specify that that constructor must exist

I need to write the following concept:

1
2
3
4
5
6
template<typename T>
concept Element = requires (T a, T b)
{
	a = b;
	T c{ a };
};


I know I can do

 
requires std::is_copy_constructible_v<T>;


but I want to create an object of type T inside the concept!


So I can check for other things, e.g.'

1
2
3
4
5
6
7
template<typename T>
concept Element = requires (T a, T b, int i)
{
	a = b;
	T c{ a };
        T d{i};
};



Last edited on
Topic archived. No new replies allowed.