Closed Mayedl10 closed 9 months ago
will improve readability and compile time
either just
struct intPair { int first; int second; }
or this thing I use in some of my projects
template<typename T1, typename T2> struct customPair { T1 first; T2 second; customPair(T1 x, T2 y) { first = x; second = y; } customPair() {} const T1& operator[](int index) const { if (index == 0) { return first; } else if (index == 1) { return second; } else { // Handle out-of-bounds access or throw an exception // For simplicity, returning first element if out-of-bounds return first; } } };
will improve readability and compile time
either just
or this thing I use in some of my projects