Details
-
Type:
Improvement
-
Status: To Do
-
Resolution: Unresolved
-
Fix Version/s: None
-
Component/s: afw
-
Labels:None
-
Story Points:6
-
Epic Link:
-
Team:Alert Production
Description
The GenericMap.apply methods take a user-defined callable ("visitor") that must have a method template or explicit method overload for each type listed in the protected GenericMap.StorableType. This adds a burden to users, because changes to StorableType may break all visitors. The burden is particularly onerous because boost::variant cannot handle implicitly convertible types well, so, for example, a visitor must have separate float and double overloads.
Reduce the coupling between apply's visitors and StorableType so that a user can, for example, provide a single integer and a single floating-point method.
It may be possible to do this by providing an adapter that fully enumerates StorableType's types, but delegates to a (possibly less comprehensive) user-defined visitor using ordinary function dispatch. Note that const visitors are allowed to accept arguments by any combination of value and reference to const, and that mutating vistors may, in addition, take arguments by reference to non-const. The adapter must be flexible enough to behave naturally for any combination of these three cases.