CUDA with D?

2009-02-18 Thread Trass3r
Is there any tutorial or code for using CUDA with D?

aliases and templates

2009-01-22 Thread Trass3r
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

Re: loop through specific class members

2009-01-21 Thread Trass3r
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,

Re: query interface

2009-01-21 Thread Trass3r
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 :

Re: compile time output

2009-01-20 Thread Trass3r
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 :(

Re: loop through specific class members

2009-01-20 Thread Trass3r
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

Re: loop through specific class members

2009-01-20 Thread Trass3r
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

Re: compile time output

2009-01-20 Thread Trass3r
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?

Re: compile time output

2009-01-20 Thread Trass3r
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

Re: compile time output

2009-01-20 Thread Trass3r
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()'

time measurement under linux?

2009-01-19 Thread Trass3r
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

Re: loop through specific class members

2009-01-19 Thread Trass3r
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

Re: loop through specific class members

2009-01-19 Thread Trass3r
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

Re: time measurement under linux?

2009-01-19 Thread Trass3r
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

Re: loop through specific class members

2009-01-19 Thread Trass3r
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

<    1   2   3   4