Freedom-of-Form-Foundation / anatomy3d

A CAD tool for humanoid anatomy alterations. See the anatomy3d-blender repository for more recent work.
https://freedomofform.org/1856/3d-anatomy-project-scope-phase-1-focus-on-a-limb-joint/
GNU General Public License v2.0
8 stars 5 forks source link

Make ConstantFunction autocast to arbitrary TIn #44

Open AdamNorberg opened 3 years ago

AdamNorberg commented 3 years ago

ConstantFunction is a ContinuousMap that only ever returns one fixed value. It's innately indifferent to its TIn type.

Write a generic implicit cast to convert any ConstantFunction<TIn, TOut> to ConstantFunction<TIn2, TOut> for arbitrary TIn and TIn2 types, since the ConstantFunction doesn't use its input. The same function should be declared for a cast to ContinuousMap<TIn2, TOut>, since I'm not sure whether an upcast will implicitly combine with a user-defined conversion operator.