xeus-cling icon indicating copy to clipboard operation
xeus-cling copied to clipboard

Avoid injecting template to ADL

Open SoilRos opened this issue 2 years ago • 2 comments

The current default implementation of mime_bundle_repr injects a template to the Argument Dependent Lookup. This is very inconvenient because the user may also want to also provide a templated function. Unfortunately, this will fail in the overload resolution stage because of ambiguity (see https://godbolt.org/z/n9xxE44TW). Therefore (based on https://godbolt.org/z/Gsr1fq6TM), I propose a concept check that test if the user provided her own mime_bundle_repr and if so dispatch it to the display data, otherwise, call the fallback implementation.

SoilRos avatar Sep 26 '21 16:09 SoilRos

@dokempf would you help me fixing the CI? I have no local setup to try this out.

SoilRos avatar Sep 26 '21 17:09 SoilRos

We fixed the CI. In case @SoilRos 's Godbolt examples are not exposing the existing problem enough, here is a very minimal example (a trimmed down version of actual code) that shows the issue:

xeuscling_adl

Note that providing an overload for A specifically is not a viable solution for us as the actual code needs to be based on a concept check (see code in ->decltype(... comments).

dokempf avatar Sep 29 '21 13:09 dokempf

This PR was automatically closed when I renamed the master branch into main, sorry for that. You can reopen it to the main branch, I will review it.

JohanMabille avatar Oct 24 '22 16:10 JohanMabille