Hi,
Is there any way to specify a parameter as something that can be called with
parameter types A, B, C and that returns a value of type D, without caring
whether it's a delegate, a function, or an object that overloads opCall? (This
might require the use of templates, but I still can't figure
On Wednesday 12 January 2011 00:21:54 %u wrote:
Hi,
Is there any way to specify a parameter as something that can be called
with parameter types A, B, C and that returns a value of type D, without
caring whether it's a delegate, a function, or an object that overloads
opCall? (This might
%u wrote:
Hi,
Is there any way to specify a parameter as something that can be called
with parameter types A, B, C and that returns a value of type D, without
caring whether it's a delegate, a function, or an object that overloads
opCall? (This might require the use of templates, but I
I've found this behavior while toying with opCall() in a struct:
import std.stdio;
struct Struct
{
this(int value) { writeln(Struct.this(, value, )); }
~this() { writeln(Struct.~this()); }
}
void main()
{
Struct s = Struct(1); // prints `Struct.this(1)`
s(2); //
is it available?
See also:
http://d.puremagic.com/issues/show_bug.cgi?id=4053
Bye,
bearophile
Yes, it was meddling with that bug that I cooked this one.
I think Adam got it right: There should be no problem between an instance
opCall and a constructor. In your case, it seems, a static opCall was
clashing with the constructor. But it turns out a non-static opCall clashes
with a constructor
Putting here that the following worked for me.
string str
ubyte[] buffer;
foreach(ch;str) {
ubyte[4] buf;
int len = encodingScheme.encode(ch, buf);
buffer~=buf[0..len];
}
ubyte[] encodedBuffer;
string decodedString;
while(encodedBuffer.length0) {
Hi,
Is there a way to parse a Time string like 15:45 to a Date structure.
Parse method in std.date returns it as invalid. As a hack it works by
prepending it with something like 1-1-1970. But is there a cleaner
way to it.
Thanks
Mandeep
Sean Eskapp eatingstap...@gmail.com wrote:
The language documentation covers some basic uses of TypeTuples in
templates,
but nothing about using them with classes. I would like a template class,
which essentially wraps a function, which has template parameters for
return
value and template
09.01.2011 15:22, %u пишет:
== Quote from bearophile (bearophileh...@lycos.com)'s article
%u:
func(cast(I2)(new C()));
That code smells a bit (http://en.wikipedia.org/wiki/Code_smell ).
Bye,
bearophile
Extract the construction and you get:
module main;
interface I1{}
interface I2 :
I only need something to make a void deleg() from a void func().
== Quote from Stanislav Blinov (bli...@loniir.ru)'s article
In C++ I sometimes have similar problems, especially with multiple
inheritance. Though, as Jonathan mentioned, those problems are even more
annoying because of hijacking: you don't always immediately notice them.
Long ago I've decided
%u e...@ee.com wrote:
I only need something to make a void deleg() from a void func().
This works for me:
ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( F
fn ) {
return ( ParameterTypeTuple!( F ) args ){ return fn( args ); };
}
--
Simen
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal case.
%u e...@ee.com wrote:
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal
case.
Please do post it, yes. As for searching, if you are willing to share
the code , others may be willing to do the search.
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article
%u e...@ee.com wrote:
I only need something to make a void deleg() from a void func().
This works for me:
ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( F
fn ) {
return ( ParameterTypeTuple!( F )
Mandeep Singh Brar Wrote:
Hi,
Is there a way to parse a Time string like 15:45 to a Date structure.
Parse method in std.date returns it as invalid. As a hack it works by
prepending it with something like 1-1-1970. But is there a cleaner
way to it.
Thanks
Mandeep
No. Though std.date
On Wednesday, January 12, 2011 07:29:39 Mandeep Singh Brar wrote:
Hi,
Is there a way to parse a Time string like 15:45 to a Date structure.
Parse method in std.date returns it as invalid. As a hack it works by
prepending it with something like 1-1-1970. But is there a cleaner
way to it.
%u wrote:
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal case.
Can you post the entire source code?
It's important that it be reproducible. It doesn't need to be minimal -
someone else can reduce it.
== Quote from Don (nos...@nospam.com)'s article
%u wrote:
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal case.
Can you post the entire source code?
It's important that it be reproducible. It doesn't
That looks like it.. only, it's not working:
void main()
{
TypeTuple!(int, int) foo;
foo[0] = 1;
foo[1] = 2;
double MakeStuff(in int bar)
{
return cast(double)bar;
}
auto foobar = staticMap!(MakeStuff)(foo);
}
This fails
Nevermind, I see my error.
Thank you!
I have a variable of type TypeTuple!(int, int), and I want to convert all its
elements into a variable of type TypeTuple!(string, string). Is there a way to
do this? Using a loop fails compilation with Error: Integer constant
expression expected instead of i.
I'd also like to be able to convert
Sean Eskapp eatingstap...@gmail.com wrote:
I have a variable of type TypeTuple!(int, int), and I want to convert
all its
elements into a variable of type TypeTuple!(string, string). Is there a
way to
do this? Using a loop fails compilation with Error: Integer constant
expression expected
Sean Eskapp Wrote:
I have a variable of type TypeTuple!(int, int), and I want to convert all its
elements into a variable of type TypeTuple!(string, string). Is there a way to
do this? Using a loop fails compilation with Error: Integer constant
expression expected instead of i.
I'd also
Wow, missed the part where TypeTuples can hold values. I suggest looking into
using Tuple from std.typecons.
What you need to remember is that you are not casting the tuple, you are
casting the data in the tuple which creates a completely different tuple.
It seems you are trying to use the
Sorry to bump this up, but is RefCounted(T) really leaking, or am I missing
something? I would like to use this in my program, and I'm curious as to why no
one responded, since if it's actually leaking, it would be an important issue.
Thanks!
On Wednesday, January 12, 2011 15:29:51 %u wrote:
Sorry to bump this up, but is RefCounted(T) really leaking, or am I missing
something? I would like to use this in my program, and I'm curious as to
why no one responded, since if it's actually leaking, it would be an
important issue.
There
29 matches
Mail list logo