When rightMap is applied to Either containing non-copyable type instance,
such as std::unique_ptr<T>, then the compiler will hard fail trying to
deduce types (rightMap && should be picked) because there is (R2) cast
applied to std::move argument, thus forcing copy construction.
When
rightMap
is applied toEither
containing non-copyable type instance, such asstd::unique_ptr<T>
, then the compiler will hard fail trying to deduce types (rightMap &&
should be picked) because there is(R2)
cast applied tostd::move
argument, thus forcing copy construction.leftMap
works because it does not have such cast.