On Wednesday, 12 December 2012 at 15:21:16 UTC, Ali Çehreli wrote:
On 12/12/2012 06:49 AM, Cube wrote:
> Better example code for my other problem. How can I make the
3rd foo
> work on Datas?
>
> --
> struct Data(T)
> {
> T elem;
> }
Data is a struct template, not a
Better example code for my other problem. How can I make the 3rd
foo work on Datas?
--
struct Data(T)
{
T elem;
}
void main()
{
foo(1);
foo([1,1]);
auto tmp1 = new Data!(int);
tmp1.elem = 3;
foo(tmp1);
auto tmp2 = new Data!(string);
On Wednesday, 12 December 2012 at 12:34:34 UTC, bearophile wrote:
Cube:
I'm having a problem getting templates to work correctly.
I want to handle arrays differently, but when I try to compile
the following example code it says it matches more than 1
template. What is the correct way
Hi,
I'm having a problem getting templates to work correctly.
I want to handle arrays differently, but when I try to compile
the following example code it says it matches more than 1
template. What is the correct way to do this?
--
void main()
{
foo(1);
foo([1,1]);
}
void foo(T)(T t