On Wednesday, 23 April 2014 at 22:07:32 UTC, John Colvin wrote:
On Wednesday, 23 April 2014 at 18:04:05 UTC, monarch_dodra
wrote:
If you can't update your compiler, an alternative is to make
your non-template version an actual template:
class Foo{
this(T : int)(T x){}
this(T)(T x) {}
}
Hi.
I'm looking for a function that can perform multiple replaces at
once. For example, there's such function in PHP, here's example
from its site:
Does D have similar function?
On Wednesday, 23 April 2014 at 23:05:39 UTC, Matthew Dudley wrote:
tuple in this case would be the member variable of type T (from
T...) So wouldn't elem be the actual object, and not the type?
The effective lowering I was hoping for would be something like
this
if (names[0] == "one")
re
Walter Gray:
the files contain the entire definitions, so why would it be
necessary to link to them AND specify them as imports?
What am I missing here?
I don't understand why that's not regarded as a job for the
compiler. But in the standard D distribution there are programs
like rdmd that
On Wed, 23 Apr 2014 20:34:11 -0400, Walter Gray
wrote:
Hi there,
I'm currently trying to set up a small demo project using the Leap
Motion API in D. I've run SWIG with -d -d2, and created the
intermediate C++ DLL along with a pair of .d files, leap.d and
leap_im.d. I'm new to D, but
Hi there,
I'm currently trying to set up a small demo project using the
Leap Motion API in D. I've run SWIG with -d -d2, and created the
intermediate C++ DLL along with a pair of .d files, leap.d and
leap_im.d. I'm new to D, but very interested and I'd like to set
this up in an idiomatic wa
On Wednesday, 23 April 2014 at 00:02:29 UTC, Jesse Phillips wrote:
On Tuesday, 22 April 2014 at 07:54:34 UTC, Matthew Dudley wrote:
Here's the gist of what I'm trying to do.
https://gist.github.com/pontifechs/11169069
I'm getting an error I don't understand:
tinker.d(42): Error: mismatched fu
On Wednesday, 23 April 2014 at 18:04:05 UTC, monarch_dodra wrote:
If you can't update your compiler, an alternative is to make
your non-template version an actual template:
class Foo{
this(T : int)(T x){}
this(T)(T x) {}
}
I haven't tested, but wouldn't this be more precisely equivale
On Wednesday, 23 April 2014 at 16:44:37 UTC, Charles McAnany
wrote:
Friends,
I have a class that needs two constructors:
class Foo{
this(int x){}
this(T)(T x) if(!is(T == int)){}
}
void main(){}
But this does not compile because the two constructors conflict:
buggy.d(3): Error: templa
Charles McAnany:
this(int x){}
this(T)(T x) if(!is(T == int)){}
}
void main(){}
But this does not compile because the two constructors conflict:
Try adding the negative constraint:
this(T)(in T x) pure nothrow if(is(T == int)) {}
this(T)(in T x) pure nothrow if(!is(T == int)) {}
Bye
Friends,
I have a class that needs two constructors:
class Foo{
this(int x){}
this(T)(T x) if(!is(T == int)){}
}
void main(){}
But this does not compile because the two constructors conflict:
buggy.d(3): Error: template buggy.Foo.__ctor(T)(T x) if (!is(T ==
int)) conflicts with constr
Hi,everyone,
It works maybe the best:
import std.stdio;
template isin(T){
bool isin(T[] Array,T Element){
foreach(T ArrayElement; Array){
if(Element==ArrayElement){ return true;}
}
return false;
}
}
void main(string[] args)
{
int[] stuff=[0,1,2,3,4,5
Hi,everyone,
This code must add the 'break',
import std.stdio;
int x=0;
template isin(T){
bool isin(T[] Array,T Element){
bool rtn=false;
foreach(T ArrayElement; Array){
if(Element==ArrayElement){
rtn=true; break; ← //here add break
On Tuesday, 22 April 2014 at 15:25:04 UTC, monarch_dodra wrote:
Yeah, that's because join actually works on "RoR, R", rather
than "R, E". This means if you feed it a "string[], string",
then it will actually iterate over individual *characters*. Not
only that, but since you are using char[], it
On Tuesday, 22 April 2014 at 18:49:41 UTC, Steven Schveighoffer
wrote:
On Tue, 22 Apr 2014 14:47:19 -0400, monarch_dodra
wrote:
In this case no, but;
//
int[1] foo();
int[] a = foo();
//
*is* slicing an rvalue, and it *does* compile. I don't think
there needs to be escape analysis to
15 matches
Mail list logo