@daniel I’m agree, this is a serious drawback (as for std::Tuple).
@PluginPenguin Thanks! I didn’t know that it could be done without modify the JUCE source.
I did a quick test for fun.
namespace std {
template <> struct tuple_size<juce::Rectangle<int>> : integral_constant<size_t, 2> {};
template <> struct tuple_element<0, juce::Rectangle<int>> { using type = int; };
template <> struct tuple_element<1, juce::Rectangle<int>> { using type = int; };
}
namespace juce {
template<std::size_t Index> std::tuple_element_t<Index, juce::Rectangle<int>> get (const juce::Rectangle<int>& r)
{
if constexpr (Index == 0) return r.getWidth();
if constexpr (Index == 1) return r.getHeight();
}
}
void MainComponent::resized()
{
const auto [w, h] = getLocalBounds();
DBG (w);
DBG (h);
}
And it seems to work perfectly fine.