diff --git a/doc/faq.xml b/doc/faq.xml index c9e9ac6..395442c 100644 --- a/doc/faq.xml +++ b/doc/faq.xml @@ -5,6 +5,87 @@
operator==
or
+ operator!=
?f ==
+ g
given f
and g
are:f
and g
+ store function objects of the same type, use that type's
+ operator==
to compare
+ them.f
and g
+ store function objects of different types, return
+ false
.f
and g
doesn't have an
+ operator==
: we would like the expression f ==
+ g
to fail to compile, as occurs with, e.g., the standard
+ containers. However, this is not implementable for
+ operator==
later: it must either find a way to call
+ operator==
now, or it will never be able to call it
+ later. Note, for instance, what happens if you try to put a
+ float
value into a
+ operator()
, because the function-call expression
+ must be bound in the constructor or assignment operator.operator==
can be called for a
+ particular type, and then supporting it only when it is
+ available; in other situations, an exception would be
+ thrown. However, to date there is no known way to detect if an
+ arbitrary operator expression f == g
is suitably
+ defined. The best solution known has the following undesirable
+ qualities:operator==
is not accessible (e.g., because it is
+ private
).operator==
is ambiguous.operator==
declaration is correct, even though
+ operator==
may not compile.operator==
, e.g., by providing an
+ is_equality_comparable
trait they may
+ specialize. This is a workable solution, but is dangerous in
+ practice, because forgetting to specialize the trait will result
+ in unexpected exceptions being thrown from
+ operator==
. This essentially negates the usefulness
+ of operator==
in the context in which it is most
+ desired: multitarget callbacks. The
+