Is there any tutorial or code for using CUDA with D?
I already read about Implicit Template Properties:
If a template has exactly one member in it, and the name of that member
is the same as the template name, that member is assumed to be referred
to in a template instantiation
I guess the following is something similar, but why are aliases
Christopher Wright schrieb:
On the other hand, you can get the non-final, non-private methods of a
class with something like:
foreach (member; __traits (allMembers, Class))
{
foreach (overload; __traits (getVirtualFunctions, Class, member))
{
// do stuff
}
}
Naturally,
Qian Xu schrieb:
Thanks. Could you tell me, how to make a function for this? I do not know
how to pass an Interface as parameter.
like
bool supports(T)(T obj, interface_type t)
{
return (is(obj : t));
}
Guess something like
bool supports(T, I) (T obj)
{
return (is(obj :
Bill Baxter schrieb:
try indexing explicitly or using ref:
foreach(i,m; members)
{
pragma(msg, members[i]);
}
foreach(ref m; members)
{
pragma(msg, m);
}
Latter one may not be useful. I can't recall.
Neither one works for me :(
Jarrett Billingsley schrieb:
On Tue, Jan 20, 2009 at 10:29 AM, Trass3r mrmoc...@gmx.de wrote:
It seems like there is no way to automatically get the class methods in D1
currently?!
__traits isn't supported, std.traits doesn't give anything usable, .tupleof
only gets the fields (plus only giving
Jarrett Billingsley schrieb:
On Tue, Jan 20, 2009 at 2:13 PM, Trass3r mrmoc...@gmx.de wrote:
Yeah, __traits works quite well to get the function names, but I still can't
manage to get the corresponding function object to pass it to
ParameterTypeTuple (for checking the parameters for correctness
BCS schrieb:
I don't do 2.0 but it looks to me like your mixing runtime and compile
time stuff. A foreach over an array is a runtime foreach.
Do you know how I could make it run at compile-time?
BCS schrieb:
template Tpl(T...)
{
alias T Tpl;
}
template Range(int l, int u)
{
static if(lu)
alias Tpl!(l, Range!(l+1,u)) Range;
else
alias Tpl!(l) Range;
}
const char[][] set = [Hello[], world ];
void main()
{
foreach(str; Range!(0,set.length-1)) // compile time foreach over the
Sergey Gromov schrieb:
class Cls
{
int bar;
char[] baz;
}
string foo()
{
auto members = __traits(allMembers, Cls);
return ;
}
pragma(msg, foo());
dmd -c test.d
test.d(11): Error: cannot evaluate foo() at compile time
test.d(11): pragma msg string expected for message, not 'foo()'
I wrote a module to ease time measurement in my projects.
Does anyone know how to get elapsed milli- or nanoseconds under linux?
Want to make it portable :)
module time;
version(Windows)
import std.c.windows.windows;
long frequency; /// frequency of the high
Daniel Keep schrieb:
Assuming you're using D2, http://digitalmars.com/d/2.0/traits.html might
prove to be of interest.
-- Daniel
It is indeed of interest though being not exactly what I want. Seems
like there's currently no way to get attributes like public etc.
But I think an acceptable
BCS schrieb:
Reply to Lutger,
Another possible hack: if used from a
different module, you could use the 'compiles' trait with allMembers
to find out if a member can be accessed.
you could define a template in another module that does the check and
returns the result.
Well, it'd indeed
Jarrett Billingsley schrieb:
On Mon, Jan 19, 2009 at 10:41 AM, Daniel Keep
daniel.keep.li...@gmail.com wrote:
Trass3r wrote:
I wrote a module to ease time measurement in my projects.
Does anyone know how to get elapsed milli- or nanoseconds under linux?
Want to make it portable :)
[snip
Daniel Keep schrieb:
Another possible hack: if used from a
different module, you could use the 'compiles' trait with allMembers
to find out if a member can be accessed.
you could define a template in another module that does the check and
returns the result.
Well, it'd indeed be used from a
301 - 315 of 315 matches
Mail list logo