C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Function overload set type information loss

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Thu, 1 Aug 2024 01:47:11 +0200
czw., 1 sie 2024 o 01:12 organicoman via Std-Proposals
<std-proposals_at_[hidden]> napisaƂ(a):
>
> I guess, i get what is the problem.
> People are reading the proposal and try to box it inside the current implementation of C++.
>

I would suggest you to start FROM current implementation of C++.

> Free your minds guys,
> Read it without any pre setup thoughts, or pretend it works somehow (like Tiago did in the beginning)
> Try to use it in on some examples, it you find contradiction, or you can't generate code, then report it. That's all.
>

You already contradict yourself

> auto f1 = &foo<5>;
> auto f2 = &foo<-3>;
>
> if(std::is_same_v<decltype(f1), decltype(f2)>)
> cout << " f1(1) must equal f2(1) is" << boolalpha<< (f1(1)==f2(1));

For you this is bad, but this:

```
template<int I>
int foo() { return 42; }

template<int I>
int bar() { return 13; }

int main()
{
   auto f1 = &foo<5>;
   auto f2 = &bar<5>;
   if(std::is_same_v<effdecltype(f1), effdecltype(f2)>)
    cout << " f1(1) must equal f2(1) is" << boolalpha<< (f1(1)==f2(1));
}
```

Is it fine? Even though we have the same "type" but diffrent mapping.

>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-07-31 23:47:24