Dear All,

How does one use 'alias' to incorporate function arguments as well?

(I believe this is possible, from some of the examples of aliasSeq, and the traits.Parameters documentation. However, I was unable to come up
with anything that works.)

What should replace the question marks (???) below?

double bar( int a, double x){
  return a*x:
}

template foo(T){
  static if ( is(T==int) ){
     alias ??? = ???
  }
  else{
     alias ??? = ???
  }
}

// when T == int, I desire the aliasing to produce resulting code:
foo( int a) = bar( int a, 42.33);

// when T == double, I desire:
foo( double x) = bar( 7, x);


Thanks kindly for any information!
James

PS I am aware of the "struct holding a function allowing multiple dispatch concept" ... while that would fit quite okay here in my simple example, it isn't appropriate
for my real use.

Reply via email to