microsoft / microsoft/STL

<complex>: Investigate simplifying complex<NonFloating>

Open
#756 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

The primary template for _Ctraits<_Ty> is used for _Ty other than float, double, and long double:

https://github.com/microsoft/STL/blob/852a3085906108045a3951064baaf4952f596e9e/stl/inc/complex#L57-L170

Therefore, it's very weird - WG21-N4861 26.4 [complex.numbers]/2 says "The effect of instantiating the template complex for any type other than float, double, or long double is unspecified." Based on this code, I believe that we have non-Standard support for complex<int> etc. (Gaussian integers):
https://github.com/microsoft/STL/blob/852a3085906108045a3951064baaf4952f596e9e/stl/inc/complex#L1815-L1817

Because this is ancient, I suspect that removing our non-Standard support for complex<Integral> would break a lot of code. However, we could investigate simplifying the machinery here, as long as we're careful to preserve the runtime behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading stl/inc/complex around lines 57-170 and 1815-1817, then trace how _Ctraits<_Ty> supports complex integral types. Compare the existing behavior with the standard's unspecified status and determine whether the machinery can be simplified without changing runtime behavior. Done means a justified simplification plan or implementation that preserves the relevant behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.