C++ Logo

std-proposals

Advanced search

Re: [std-proposals] concepts in <complex>

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Wed, 4 May 2022 09:25:50 +0200
On 04/05/2022 09.10, Abdullah Qasim via Std-Proposals wrote:
>
>
> Right now, complex class is pretty WIERD:
>
>
>
> complex<char> c(‘1’, ‘2’);

What's weird about this?

See [complex.numbers.general] p2;
your implementation is at liberty to make that ill-formed.

> LOL.

As I said in some other thread, please don't assume
acronyms you're familiar with have any meaning for
the diverse international audience (including non-
native speakers) in this forum.

> Why not implement a concept in <complex.h>: (in anonymous namespace)

Adding a concept to an existing template may have
ABI impact. We need an analysis when that happens
and how widespread the backward compatibility problems
might be.

Jens


> template <typename T>
>
> concept C = std::_Is_nonbool_integral<T>() || std::is_floating_point_v<T>();
>
>
>
> */BETTER:/*/define this concept as std::number in <stdlib.h>/
>
> / /
>
> /(And equivalent concepts in other classes)/
>
>
>
>
>
>

Received on 2022-05-04 07:25:53