On Friday, 6 March 2020 at 14:05:55 UTC, Steven Schveighoffer wrote:
Adam's way doesn't work either, because the call doesn't use the alias, but just instantiates opDispatch with the new name!'

oh yikes, how did I not notice that?!

so yeah just kinda screwed. I'd probably suggest at tis point having the opDispatch be a trivial implementation that just forwards to another named method.

struct A {
  template opDispatch(string name) {
     auto opDispatch(T, Args...)(Args args) {
           return other_name!(name, T, Args)(args);
     }
  }

  auto other_name(string name, T, Args...)(Args args) {
      // real implementation
  }
}


and then to test it externally you do

a.other_name!("whatever", Bitmap)(args, here);

Reply via email to