[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Challenge: adding new method overloads when existing consumers use {} with args
From:       David Hurka <david.hurka () mailbox ! org>
Date:       2022-07-23 18:26:47
Message-ID: 4421855.LvFx2qVVIh () doro
[Download RAW message or body]

> Had not yet thought about this challenge myself before, so curious what
> people think can be done here?

Would it work to make foo(B) less tasty for implicit conversion with 
std::variant (or another small wrapper)?

```
class C
{
public:
    void foo(A a);
    /** @since ... */
    void foo(std::variant<B> b);
};
```

My assumption is that std::variant requires a "user-defined conversion" [1], 
and therefore an explicitly provided B object can be implicitly converted to a 
std::variant<B>, but the ambiguous {} can't.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic