problem with custom predicate
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 27 10:56:26 PDT 2015
On 5/27/15 9:59 AM, Meta wrote:
>
> I thought unaryFun *does* work with all callables, including
> structs/classes with opCall?
It (binaryFun actually) declares an alias. But you need an actual
instance to use in this case. You simply can't declare that in a type
definition, and it won't be set up properly in the constructor even if
you could. You need an instance in order to use an alias to that instance.
What likely would happen is if the functor is a callable type, and that
type is not a functor itself (i.e. doesn't define static opCall), is
that RedBlackTree would then require an instance of that type as part of
the constructor.
-Steve
More information about the Digitalmars-d-learn
mailing list