Hello,
For the first time I am using JUCE’s ElementComparator template. I have created a Compartor class which is pretty much a copy-past of Default Comparator.
> template <class ElementType>
>
> class FrameComparator
>
> {
>
> private:
>
> using ParameterType = typename TypeHelpers::ParameterType<ElementType>::type;
>
>
>
> public:
>
> static int compareElements(ParameterType first, ParameterType second)
>
> {
>
> if (first.getID() < second.getID())
> return -1;
> else if (first.getID() > second.getID())
> return 1;
> else // if a == b
> return 0;
> return 0;
>
> }
>
> };
I want to use it to compare TreeViewItems. I have a FrameExplorerItem which is derived from TreeViewItem and has a getID() method.
I create an instance of my comparator and then pass it to sort method.
> FrameComparator<FrameExplorerItem> comp;
> explorerTree.getRootItem()->sortSubItems(comp);
I get the following error:
Error C2664 ‘int FrameComparator::compareElements(const FrameExplorerItem &,const FrameExplorerItem &)’: cannot convert argument 1 from ‘Type’ to ‘const FrameExplorerItem &’
I have tried multiple things but I just dont get it. Any help will be much appreciated! Thanks.
Cila.