Here's a modification showing possible solutions I can find. https://godbolt.org/z/UzIeUW Either make all arguments by ref or call std::move() on any primitives. There's got to be something I'm not doing right.
Okay, #cplusplus twitter! As far as I can tell, this is doing perfect-forwarding the "right" way.
So why does it not compile unless I call move on an *integer*? What am I missing?
https://godbolt.org/z/M7yV5d
-
-
Näytä tämä ketjuKiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
-
-
It is not doing perfect forwarding, because your operator() is not in deduced context. 'T_args' is explicitly set to 'int', and therefore operator() explicitly takes 'int&&', hence the need for move, to make it an r-value.
- Näytä vastaukset
Uusi keskustelu -
-
-
When you instantiate Delegate you are specifying the type as int you can modify the Invoke to function template and then it can work: https://godbolt.org/z/0Djj7p There may be better solutions though.pic.twitter.com/vtJCVh0St2
-
Yes! After
@bjorn_fahller's response, I started down this route and found it worked. Thank you both for your help!
Keskustelun loppu
Uusi keskustelu -
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.
