Skip to content

Collapse STRstd<T> four-overload set into one specialized template #124

Description

@gagelarsen

Follow-up from issue #116 (review MINOR finding on xmscore/misc/StringUtil.h:983-998).

The new \brief paragraph for STRstd<T> (added in PR #117's predecessor docs commits) explains the overload-resolution traps the four explicit overloads exist to dodge. The reviewer's note: this is a signal that the four-overload set could likely be collapsed into one specialized template, with the special cases handled via if constexpr (C++17) or tag dispatch.

Proposed change

  • Replace the four free STRstd overloads with a single primary template plus the specializations actually needed. Use if constexpr on std::is_floating_point_v<T> / std::is_integral_v<T> where the current overloads diverge.
  • Verify against existing call sites (downstream xms libraries call this through STRstd directly).
  • Update the \brief once the overload-trap discussion is no longer needed.

Why follow-up

The reviewer explicitly tagged this as FOR FOLLOW-UP ("signal that the four-overload set could become one specialized template"). It's a real refactor with downstream impact, not a doc fix.

Acceptance

  • One template (with specializations as needed) replaces the four overloads
  • All existing call sites in xmscore continue to compile
  • No behavior change in CxxTest coverage of StringUtil
  • \brief updated to drop the overload-trap explanation

Refs: issue #116, PR #117, xmscore/misc/StringUtil.h:983-998.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions