Hi all,
I've got this little ctfe template function that checks if a
function called member with first argument T exists. Its for
checking if a type has a custom encoder.
bool hasUFCSmember(T, string member)() {
T v;
// would be nice if we could use ParameterTypeTuple to get the
On Thursday, 29 August 2013 at 21:06:04 UTC, Rory McGuire wrote:
Hi all,
I've got this little ctfe template function that checks if a
function called member with first argument T exists. Its for
checking if a type has a custom encoder.
bool hasUFCSmember(T, string member)() {
T v
On Thursday, 29 August 2013 at 21:10:41 UTC, Rory McGuire wrote:
On Thursday, 29 August 2013 at 21:06:04 UTC, Rory McGuire wrote:
Hi all,
I've got this little ctfe template function that checks if a
function called member with first argument T exists. Its for
checking if a type has a custom
Just wondering if this exists in the standard library.
I made a function Implements!(T,I) that returns true is a given
type T implements the interface I.
http://dpaste.dzfl.pl/d7a727fd
I've found it really helps with keeping some code clean such as
the below:
void main() {
int i =
Sam Hu samhu.sa...@nospam.com wrote:
Ary Borenszweig Wrote:
You can't access non-static data from a static method. Non-static data
is related to an instance of a class, and a static method is not bound
to any instance.
Why do you want to do that?
Say I want to implement an
Saaa em...@needmail.com wrote:
struct S : Pos {}
Why is this not possible?
Why do you want to use a struct for that, rather than a class?
miriac 1234...@gmail.com wrote:
Jesse Phillips Wrote:
miriac Wrote:
I'm trying to get my program to read all the files in a directory.
dmd gives an errer that theis imports dont exist:
tango.io.FileSystem,
tango.io.FileRoots,
Can someone please help me and tell me what i use to
Mike L. sgtmuff...@myrealbox.com wrote:
Simen kjaeraas Wrote:
On Wed, 16 Dec 2009 07:25:39 +0100, Mike L. sgtmuff...@myrealbox.com
wrote:
I'm making a class template that only works with strings, so I thought
it'd be good to instantiate each template with char, wchar, and dchar
On Wed, 23 Jun 2010 00:30:40 +0200, Ali Çehreli acehr...@yahoo.com wrote:
dcoder wrote:
So, I moved the initialization to inside the main function, and now
it works.
Great. I think we need to put this question in the FAQ.
For future reference, if it really needs to be global:
On Mon, 28 Jun 2010 11:09:13 +0200, Matthias Walter
xa...@xammy.homelinux.net wrote:
On 06/28/2010 09:49 AM, Justin Spahr-Summers wrote:
On Sun, 27 Jun 2010 18:51:35 +0200, Matthias Walter
xa...@xammy.homelinux.net wrote:
Hi list,
I tried to write a traits class comparable to
On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud
philippe.sig...@gmail.com wrote:
Is it defined somewhere that auto functions are not authorized inside
main?
void main()
{
auto fun(string s) { return s;} // this does not compile
}
error:
main.d|6|found 's' when expecting ')'|
On Mon, 28 Jun 2010 16:07:43 +0200, Philippe Sigaud philippe.sig...@gmail.com wrote:On Mon, Jun 28, 2010 at 15:40, Rory McGuire rmcgu...@neonova.co.za wrote:
void main()
{
auto fun(string s) { return s;} // this does not compile
}
Hope this isn't a stupid question, but how would you
On Mon, 28 Jun 2010 16:01:46 +0200, BCS n...@anon.com wrote:
Hello Rory,
On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud
philippe.sig...@gmail.com wrote:
void main()
{
auto fun(string s) { return s;} // this does not compile
}
Hope this isn't a stupid question, but how would you
On Mon, 28 Jun 2010 22:37:06 +0200, BLS windev...@hotmail.de wrote:
Hi I have a forward reference pb in conjunction with @property.
Err msg is :
forward refrence to inferred return type of function call s1.servername.
any ideas ? beside, where are the @property docs ?
thanks, bjoern
final
On Tue, 29 Jun 2010 07:16:13 +0200, BCS n...@anon.com wrote:
Hello Mike,
I want to do the following:
foreach(obj; list)
{
if(obj.pleaseKillMe)
somehow_remove_the_object_from_the_list();
}
That isn't legal for normal arrays or AAs. IIRC the docs even say that
you can't change what a
On Tue, 29 Jun 2010 14:42:33 +0200, BLS windev...@hotmail.de wrote:
Hi bearophile,
sorry for my ignorance, but what is the difference between @disable and
simply deleting the line ?
where can I read more about @disable ?
thanks, bjoern
@disable propagates throughout the objects hierarchy
On Wed, 07 Jul 2010 00:47:32 +0200, BLS windev...@hotmail.de wrote:
Okay a bit better snippet than before. snippet should be almost
functional..
/*
Hi,
Andrei brings in the idea of std.pattern. Seems that this module is
stalled; Unfortunately !
However I would like to enhance collection
On Mon, 12 Jul 2010 08:25:32 +0200, Jonathan M Davis
jmdavisp...@gmail.com wrote:
Okay. There are cases where you want a constructor to do something when
the
class/struct is created, and you want the destructor to do something
when the
class/struct goes out of scope. A classic example
On Thu, 15 Jul 2010 00:22:34 +0200, Jonathan M Davis
jmdavisp...@gmail.com wrote:
I was wondering what the general consesus was (if there is one) on
whether it's
valuable to always put module declarations in each module.
Obviously, if you need the module to have a name other than the file
On Thu, 15 Jul 2010 23:08:07 +0200, torhu n...@spam.invalid wrote:
On 15.07.2010 21:59, Rory McGuire wrote:
From what I remember in TDPL:
Can be used to rename a module if you have it in a different directory
structure than how you use it. E.g. implementation and headers in
separate folders
e s cannot be read at compile timestruct.d(14): Error: cannot evaluate s.getString() at compile times.getString()
Rory McGuire
R
Tel : +27 (033) 386 7263
Cell : +27 (082) 856 3646
Email: rmcgu...@neonova.co.za
Website: www.neonova.co.za
VCard: View
This email and its attachments may be co
Sorry about the html
On Fri, 16 Jul 2010 11:46:48 +0200, Rory McGuire rmcgu...@neonova.co.za
wrote:
import std.stdio;
struct State {
string s; string getString() { return s; }
static State opCall(string s) {
State ret;
ret.s = s
On Fri, 16 Jul 2010 11:58:57 +0200, Lars T. Kyllingstad
pub...@kyllingen.nospamnet wrote:
On Fri, 16 Jul 2010 11:46:48 +0200, Rory McGuire wrote:
import std.stdio;
struct State {
string s; string getString() { return s; } static State opCall(string
s) {
State ret;
ret.s = s
On Fri, 16 Jul 2010 12:05:02 +0200, Jonathan M Davis
jmdavisp...@gmail.com wrote:
On Friday 16 July 2010 02:46:48 Rory McGuire wrote:
import std.stdio;
struct State {
string s; string getString() { return s; }
static State opCall(string s) {
State ret;
ret.s = s;
return ret
Hi,
Does anyone know how to detect if there is a setter for a property? The
code below prints the same thing for both
the setter and the getter of front:
==
import std.traits;
class Foo {
uint num;
@property ref uint front() {
return num;
On Mon, 19 Jul 2010 22:06:14 +0200, Simen kjaeraas
simen.kja...@gmail.com wrote:
Rory McGuire rmcgu...@neonova.co.za wrote:
Does anyone know how to detect if there is a setter for a property? The
code below prints the same thing for both
the setter and the getter of front
On Mon, 19 Jul 2010 23:25:01 +0200, Jonathan M Davis
jmdavisp...@gmail.com wrote:
On Monday, July 19, 2010 13:42:51 Philippe Sigaud wrote:
On Mon, Jul 19, 2010 at 22:06, Simen kjaeraas
simen.kja...@gmail.comwrote:
template hasSetter(alias func) if (isCallable!(func)) {
enum hasSetter
On Mon, 19 Jul 2010 22:42:51 +0200, Philippe Sigaud philippe.sig...@gmail.com wrote:On Mon, Jul 19, 2010 at 22:06, Simen kjaeraas simen.kja...@gmail.com wrote:
template hasSetter(alias func) if (isCallable!(func)) {
enum hasSetter = isProperty!(func)
is( typeof( (){ func =
Hi,
I'm not sure this is in bugzilla, I tried finding something mentioning it
but coudn't.
Compiling the below code results in the dmd compiler printing:
struct_bad_error.d(8): Error: 'this' is only defined in non-static member
functions, not inner
struct S {
S
Hi,
What is one supposed to use to flush a TcpSocket.
flush doesn't seem to exist, should I really just use the c function?
-Rory
Heywood Floyd wrote:
Rory Mcguire Wrote:
Hi,
What is one supposed to use to flush a TcpSocket.
flush doesn't seem to exist, should I really just use the c function?
-Rory
Was in a similar situation, found this:
http://stackoverflow.com/questions/855544/is-there-a-way
Philippe Sigaud wrote:
On Mon, Jul 26, 2010 at 19:11, dcoder dco...@devnull.dev wrote:
== Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article
Dmitry Olshansky wrote:
std.typecons.Tuple fields cannot be indexed like arrays, Andrei made a
mistake. To access field #n, use ._n
Philippe Sigaud wrote:
On Tue, Jul 27, 2010 at 11:25, Rory Mcguire rjmcgu...@gm_no_ail.com
wrote:
Also, in my case, the return; in writer must be commented out, or DMD
complains it cannot be reached.
Interesting, I didn't have to comment out return; using dmd 2.047 on
linux
I
dcoder wrote:
Hello. Here's a short program that works in a dos window:
import std.stdio;
void main() {
writef( What is your name?);
string name = readln();
writefln( Hello ~ name);
}
The program prints a prompt without a newline and the user enters a name
and a
Jacob Carlborg wrote:
On 2010-07-26 14:27, Rory Mcguire wrote:
Hi,
I'm not sure this is in bugzilla, I tried finding something mentioning it
but coudn't.
Compiling the below code results in the dmd compiler printing:
struct_bad_error.d(8): Error: 'this' is only defined in non-static
Nick Sabalausky wrote:
Is there a way to get stack traces on exceptions in D2?
What OS.
I'm on linux and I get stack traces.
Nick Sabalausky wrote:
Nick Sabalausky a...@a.a wrote in message
news:i2rbht$22v...@digitalmars.com...
Rory Mcguire rjmcgu...@gm_no_ail.com wrote in message
news:i2rafu$20l...@digitalmars.com...
Nick Sabalausky wrote:
Is there a way to get stack traces on exceptions in D2?
What OS.
I'm
Steven Schveighoffer wrote:
On Wed, 28 Jul 2010 11:45:59 -0400, Rory Mcguire rjmcgu...@gm_no_ail.com
wrote:
Hi guys,
I have a 265 line program that gets a segmentation fault if I don't
comment
out this while loop(I am not using delete or anything like it):
/+ while (lines.length 0
Jason Spencer wrote:
Ok, I've gone over this, adapted it, and mostly understand it. I just
have one question left:
== Quote from bearophile (bearophileh...@lycos.com)'s article
template Iota(int stop) {
...
alias TypeTuple!(Iota!(stop-1), stop-1) Iota;
}
...
foreach (t;
Jason Spencer wrote:
== Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article
Jason Spencer wrote:
I nievely went and replaced foreach (t; Iota!(str_types.length))
with foreach (t; str_types.length), since the length of that
array is known at compile-time.
your replacement
Jason Spencer wrote:
== Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article
Jason Spencer wrote:
== Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article
Jason Spencer wrote:
I nievely went and replaced foreach (t;
Iota!(str_types.length))
with foreach (t
Mafi wrote:
Am 04.08.2010 12:11, schrieb Rory Mcguire:
Hi,
The code below is my beginning to attempt a class which implements any
class and throws an exception if one tries to access any member of that
class.
Problem is that if I use:
auto a1 = noinit!(A)();
it works and accesses
Mafi wrote:
Thats what feels weird to me. a.x can result in different things
happening even though x exists in both A and the generated class. However
the generated class has two fields called x one you can't access
anymore and the @property one.
When I create an instance of the generated
Philippe Sigaud wrote:
On Fri, Aug 6, 2010 at 11:43, Rory Mcguire rjmcgu...@gm_no_ail.com
wrote:
I've been trying to make a template for this but it seems that dmd still
won't allow me to get the parameters of the constructors. dmd Seems to
think
that I'm trying to use it as a property
Rory Mcguire wrote:
Philippe Sigaud wrote:
On Fri, Aug 6, 2010 at 11:43, Rory Mcguire rjmcgu...@gm_no_ail.com
wrote:
I've been trying to make a template for this but it seems that dmd still
won't allow me to get the parameters of the constructors. dmd Seems to
think
that I'm trying
Philippe Sigaud wrote:
On Fri, Aug 6, 2010 at 21:59, Rory Mcguire rjmcgu...@gm_no_ail.com
wrote:
Here is a possible solution to your problem:
-Rory
I believe you can get the type of A. Isn't it typeof(super) or
std.traits.BaseClassesTuple!B[0] ? B in the latter case being typeof
I had been trying to use AutoImplement to make something before but it gave
me weird errors.
I'm going to try using it for implementing this when I get some time.
Andrej Mitrovic wrote:
Here's an example:
[snip]
Are all string literals that have the same value initialized to the same
address?
void main() {
string same() {
return This;
}
assert(This is same());
assert(This is This);
}
Can this be relied upon?
Rory Mcguire wrote:
Are all string literals that have the same value initialized to the same
address?
void main() {
string same() {
return This;
}
assert(This is same());
assert(This is This);
}
Can this be relied upon?
Interesting thanks guys.
Was just curious about the speed
Andrej Mitrovic wrote:
Doh! I swear I've read somewhere that a module declaration needs to have
the same name as the *file name*. I didn't know I had to add the path as
well. That makes the modules work now.
In fact, I probably just read this one line in the docs:
The ModuleDeclaration
Its not skipping its looping on a\r\n if you're on windows.
Linux it does the same but only a\n.
Not sure how you'd make it so that you don't have to wait for the
return press. Probably has something to do with console settings,
which are probably platform dependent.
-Rory
Andrej Mitrovic
51 matches
Mail list logo