I'm just reading Andreis book "Modern C++ Design" and try to translate a
few examples to D 2. My most recent test looks as follows:
import std.stdio;
struct Type2Type(T){
typedef T OriginalType;
}
class foo(T,R...) : foo!(R) {
public void print(){
super.print();
Oh I've just realized I was being a little silly here. I don't need
ref for pointers. Essentially I was looking to make this:
auto ref unqual(T)(ref T value)
{
return cast(Unqual!T)value;
}
do this:
char* unqual(const char* value)
{
return cast(char*)value;
}
Except to make it work for an
Well I've tried it with a COM object and it seems to work. So I'll
definitely use this technique now. I do wish whitehole gave me the
option to throw a custom error message.
> import std.traits;
>
> void main()
> {
> const wchar* t;
> unqual(t);
> }
>
> auto ref unqual(T)(ref T value)
> {
> return cast(Unqual!T)value;
> }
>
> I've attempted to create myself an unqual function which could for example
> do a cast from const char* to char*. The above won't
You'll need a couple of things:
Link with the user32.dll import library, which is located in
DMD\dmd2\windows\lib\user32.lib.
Either pass it to DMD during compilation or more simply just can add a
pragma(lib) in your source file like so:
pragma(lib, "user32.lib");
And you need the function protot
I have a similar problem. :)
I'd like to catch a call to a COM object to check if it was properly
initialized first.
Here's one way to do it with regular classes:
http://codepad.org/lHsQf4UG
You can read about whitehole here:
http://www.digitalmars.com/d/2.0/phobos/std_typecons.html#WhiteHole
I
import std.traits;
void main()
{
const wchar* t;
unqual(t);
}
auto ref unqual(T)(ref T value)
{
return cast(Unqual!T)value;
}
I've attempted to create myself an unqual function which could for example do a
cast from const char* to char*. The above won't work though:
test.d(14): Erro
So my research into making a nice friendly to use COM interface wrapper
for D has had a few odd turns and I am wondering if there is an answer
to making the implementation nicer.
I discovered the 'alias foo this' syntax to let structs nearly
seamlessly impersonate a member variable. This has
import std.algorithm;
struct Foo
{
int bar(string) { return 1; }
void run()
{
auto result = map!(bar)(["test"]);
}
}
void main()
{
}
D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(128): Error: this for
bar needs to be type Foo not type Map!(bar,string[]
"Robert Clipsham" wrote in message
news:ip4nhc$2mdp$1...@digitalmars.com...
> On 25/04/2011 21:38, Nick Sabalausky wrote:
>> Works on Windows command line and through IIS. And it works on my Kubuntu
>> 10.6 command line. But if I copy the executable from my Kubuntu box to my
>> web host's Debian
On 25/04/2011 21:38, Nick Sabalausky wrote:
Works on Windows command line and through IIS. And it works on my Kubuntu
10.6 command line. But if I copy the executable from my Kubuntu box to my
web host's Debian server: Running it through Apache gives me a 500, and
running it directly with ssh give
I've made a little test CGI app:
import std.conv;
import std.stdio;
void main()
{
auto content = "Hello world";
auto headers =
`HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Content-Length: `~to!string(content.length);
while(readln().length > 1) {}
writeln(headers);
writeln();
wr
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
> > == Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
> >
> > > > I'm trying to get a D2 project to build on Ubuntu through Code::Blocks.
> > > > Unfortunately, Code::Blocks doesn't allow the simple one-step
> > > > compila
On 4/25/11, Jacob Carlborg wrote:
> I'm not sure I understand but do you want to print "properties" in this
> case?
Yeah.
Hello,
I'm not familiar with DLLs, I would like to know how can I call a
function in User32.dll ? (specifically, RegisterWindowMessage)
Thank you for any help!
> == Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
>
> > > I'm trying to get a D2 project to build on Ubuntu through Code::Blocks.
> > > Unfortunately, Code::Blocks doesn't allow the simple one-step
> > > compilation that is default with dmd, so it does compiling and linking
> > > in
On 2011-04-25 18:47, Andrej Mitrovic wrote:
Good idea. .tupleof seems to avoid collecting functions which is
perfect. Here's a quick implementation:
http://codepad.org/lSDTFd7E
The only issue I have left is that the function that prints the code
doesn't really know what the variable was named i
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article
> > I'm trying to get a D2 project to build on Ubuntu through Code::Blocks.
> > Unfortunately, Code::Blocks doesn't allow the simple one-step compilation
> > that is default with dmd, so it does compiling and linking in two separate
> >
> I'm trying to get a D2 project to build on Ubuntu through Code::Blocks.
> Unfortunately, Code::Blocks doesn't allow the simple one-step compilation
> that is default with dmd, so it does compiling and linking in two separate
> steps. Unfortunately, this is causing some linker errors, the main one
I'm trying to get a D2 project to build on Ubuntu through Code::Blocks.
Unfortunately, Code::Blocks doesn't allow the simple one-step compilation that
is default with dmd, so it does compiling and linking in two separate steps.
Unfortunately, this is causing some linker errors, the main one being:
> I am trying to get the number of seconds from 1970 using the
> std.datetime module.
>
> long val = SysTime(Date(1996, 1, 1)).toUnixTime()
>
> Shouldnt the above statement give me a Timezone independent result i.e.
> 'toUnixTime'.
unix time is _always_ in UTC by definition.
You're creating a S
With the disclaimer that I haven't use it myself, only read *some* of
the docs, here is my (surely terrible) take at explaining the beast.
Mongrel2 is a neat idea based on 2 other projects:
- 0mq ( http://www.zeromq.org/ ) which is an async communication
library that feels like sockets but behav
I am trying to get the number of seconds from 1970 using the
std.datetime module.
long val = SysTime(Date(1996, 1, 1)).toUnixTime()
Shouldnt the above statement give me a Timezone independent result i.e.
'toUnixTime'.
Also, is there a method to get seconds directly from Date and DateTime
in
On Mon, 25 Apr 2011 14:07:28 -0400, Mandeep wrote:
On 04/25/2011 07:56 PM, Steven Schveighoffer wrote:
On Sat, 23 Apr 2011 02:16:22 -0400, Mandeep wrote:
Hi,
I am trying to compile the code that was working with dmd 2.050 using
dmd 2.052.
The code compiles but it gives me errors with mess
On 04/25/2011 07:56 PM, Steven Schveighoffer wrote:
On Sat, 23 Apr 2011 02:16:22 -0400, Mandeep wrote:
Hi,
I am trying to compile the code that was working with dmd 2.050 using
dmd 2.052.
The code compiles but it gives me errors with message when trying to run:
Cycle detected between module
On 25/04/2011 16:56, Jaime Barciela wrote:
Robert,
I think your effort is much needed. Thank you -- from a fellow Brown Coat :)
I just hope Captain Shiny Pants doesn't find out, I don't fancy my
chances against him in a fight if he realizes I stole his ship's name ;P
I was toying with the
Good idea. .tupleof seems to avoid collecting functions which is
perfect. Here's a quick implementation:
http://codepad.org/lSDTFd7E
The only issue I have left is that the function that prints the code
doesn't really know what the variable was named in the calling code.
As an alternative I could
Robert,
I think your effort is much needed. Thank you -- from a fellow Brown Coat :)
I was toying with the idea of writing a handler for Mongrel2 in D. But
I'm a D n00b, it may take me a while. If anybody wants to pick that
idea up and make it a reality that would be great.
In fact it will be a
On 2011-04-24 23:11, Andrej Mitrovic wrote:
This keeps popping up in my posts. Here's an example of printing out fields of
a struct with its names:
import std.stdio;
void main()
{
struct ASIOChannelInfo
{
int channel;
int isInput;
int isActive;
int
On Sat, 23 Apr 2011 04:34:39 -0400, Jonathan M Davis
wrote:
It happens when a module imports - directly or indirectly - another
module
which imports it - directly or indirectly - and they both have static
constructors and/or static destructors (it _might_ not happen if one of
them
has st
On Sat, 23 Apr 2011 02:16:22 -0400, Mandeep wrote:
Hi,
I am trying to compile the code that was working with dmd 2.050 using
dmd 2.052.
The code compiles but it gives me errors with message when trying to run:
Cycle detected between modules with ctors/dtors
The cyclic module import code
On 22/04/2011 20:48, Jonathan M Davis wrote:
Well, then I'd better make sure that I get my most recent updates to
std.datetime in soon.
- Jonathan M Davis
Does your library take into account that there's no year 0?
Actually, for ISO 8601, which the library follows, there _is_ a year 0.
And
32 matches
Mail list logo