I am writing a templated function func that takes as input a matrix. I provide a SquareMatrix class that is compatible with func, but I want other matrix implementations to be compatible with func. For that reason, I have defined a concept for matrix.
template<typename T>
concept Matrix = requires (T a, int b, int c) {
{a(b, c)} -> std::convertible_to<double>;
{a.size1()}->std::convertible_to<size_t>;
{a.size2()}->std::convertible_to<size_t>;
};
I use this concept in 3 places. In my SquareMatrix.h and my SquareMatrix.cpp, I use it to define a templated constructor that produces a SquareMatrix from another Matrix. In func.h, I use it to define the templated function func. func.h imports SquareMatrix.h.
I now need to decide in what file I should put my user-defined concept Matrix. I have several questions related to this decision:
- In what file should I put my Matrix concept? What should be the file name and extension?
- Should each concept be in its own file? Should all the concepts for my project share a file?
- I am using the Visual Studio IDE. Does that change anything?