On Saturday, 15 June 2019 at 17:42:04 UTC, ag0aep6g wrote:
On Saturday, 15 June 2019 at 17:24:45 UTC, user1234 wrote:
---
void foo(){writeln(__PRETTY_FUNCTION__);}
void main(string[] args)
{
void delegate() dg;
dg.funcptr =
dg.ptr = null; // usually a "this" or a frame address
On Saturday, 15 June 2019 at 17:24:45 UTC, user1234 wrote:
---
void foo(){writeln(__PRETTY_FUNCTION__);}
void main(string[] args)
{
void delegate() dg;
dg.funcptr =
dg.ptr = null; // usually a "this" or a frame address
dg();
}
---
because dg.ptr would be used to retrieve the
On Saturday, 15 June 2019 at 16:34:22 UTC, Robert M. Münch wrote:
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be
mixed. But the standard function std.functional.toDelegate
converts a function to a delegate."
Your example compiles
On Saturday, 15 June 2019 at 16:34:22 UTC, Robert M. Münch wrote:
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be
mixed. But the standard function std.functional.toDelegate
converts a function to a delegate."
Your example compiles
On 2019-06-15 16:19:23 +, Anonymouse said:
By design, I think: "delegate and function objects cannot be mixed. But
the standard function std.functional.toDelegate converts a function to
a delegate."
Your example compiles if the assignment is changed to dg =
toDelegate(); (given
On Saturday, 15 June 2019 at 15:54:00 UTC, Robert M. Münch wrote:
Why does the follwing code give: Error: cannot implicitly
convert expression & myFunc of type void function(int a) to
void delegate(int)
void myFunc(int a){return;}
void main()
{
void delegate(int) dg;
dg =
}
Why does the follwing code give: Error: cannot implicitly convert
expression & myFunc of type void function(int a) to void delegate(int)
void myFunc(int a){return;}
void main()
{
void delegate(int) dg;
dg =
}
See: https://run.dlang.io/is/iTYo2L
--
Robert M. Münch
On Thursday, 15 March 2018 at 15:41:54 UTC, Robert-D wrote:
Why something like this doesn't compile (with or without the
cast on bb.dup)?
struct S {
string[string] aa;
S dup() inout pure {
return S(cast(string[string]) aa.dup);
}
}
struct SS {
S[] bb;
SS dup()
On Thursday, 15 March 2018 at 13:18:38 UTC, Simen Kjærås wrote:
On Thursday, 15 March 2018 at 12:00:08 UTC, Robert-D wrote:
I want the function to create a mutable copy from a const or a
imutable
Like this:
void main() {
const S s = S(["": ""]);
S b = s.dup();
}
How can i do that?
On Thursday, 15 March 2018 at 12:00:08 UTC, Robert-D wrote:
I want the function to create a mutable copy from a const or a
imutable
Like this:
void main() {
const S s = S(["": ""]);
S b = s.dup();
}
How can i do that?
In that case, the problem is that you also have to .dup the aa:
On Thursday, 15 March 2018 at 11:33:49 UTC, Simen Kjærås wrote:
On Thursday, 15 March 2018 at 11:18:48 UTC, Robert-D wrote:
[...]
This is where things go wrong:
[...]
'inout' means that this function can keep the const, immutable
or mutable status of the type on which the function is
On Thursday, 15 March 2018 at 11:18:48 UTC, Robert-D wrote:
struct S {
string[string] aa;
S dup() inout pure {
return S(aa);
}
}
void main() {
auto s = S(["": ""]);
s.dup();
}
Result:
Error: cannot implicitly convert expression this.aa of type
struct S {
string[string] aa;
S dup() inout pure {
return S(aa);
}
}
void main() {
auto s = S(["": ""]);
s.dup();
}
Result:
Error: cannot implicitly convert expression this.aa of type
inout(string[string]) to string[string]
I need help with the above program.
import std.stdio;
import std.conv;
import std.string;
import std.net.curl;
void main()
{
string content = get(d-lang.appspot.com/testUrl2);
}
Error: cannot implicitly convert expression (get(d-lang.appsp
ot.com/testUrl2, AutoProtocol())) of type char[] to string
code from: http://dlang.org
Solution
http://forum.dlang.org/thread/bgkklxwbhrqdhveth...@forum.dlang.org#post-l639dt:24vlj:241:40digitalmars.com
Am I right understand that it's bug in doc?
On Thursday, 23 October 2014 at 19:18:33 UTC, Suliman wrote:
Solution
http://forum.dlang.org/thread/bgkklxwbhrqdhveth...@forum.dlang.org#post-l639dt:24vlj:241:40digitalmars.com
Am I right understand that it's bug in doc?
It certainly looks like one. std.net.curl's documentation
examples
10, 2013 at 6:54 AM, Dfr defle...@yandex.ru wrote:
Hello, here is example code, which doesn't work:
Variant[] vtypes = [ Variant(hello), Variant(bye) ];
string[] filetypes = map!(to!string)(vtypes);
Gives me error:
Error: cannot implicitly convert expression (map(vtypes)) of
type
Dfr:
auto vtypes = map!(to!Variant[string])(lols);
The short template instantiation syntax only supports a single
token, to avoid mistakes,so you need to add ():
map!(to!(Variant[string]))(lols);
That is better written:
lols.map!(to!(Variant[string]));
But I don't know if this is
void main()
{
Variant[] lols = [ Variant([hello: Variant(1)]), Variant([bye:
Variant(true)]) ];
auto vtypes = map!(to!Variant[string])(lols); // --- line 11
string[] filetypes = map!(to!string)(vtypes).array();
writeln(filetypes);
}
Gives me:
main.d(11) Error:
Thank you, this clears thing to me.
I currently has all stuff wrapped in Variants because it is
structure parsed from xml (or json), and it could be for example
map of Something[string], where Something could be string or
array or another map, and also this all nested few levels deep.
I'm
On Wed, Dec 11, 2013 at 7:26 AM, Dfr defle...@yandex.ru wrote:
Thank you, this clears thing to me.
I currently has all stuff wrapped in Variants because it is structure parsed
from xml (or json), and it could be for example map of Something[string],
where Something could be string or array
Hello, here is example code, which doesn't work:
Variant[] vtypes = [ Variant(hello), Variant(bye) ];
string[] filetypes = map!(to!string)(vtypes);
Gives me error:
Error: cannot implicitly convert expression (map(vtypes)) of type
MapResult!(to, VariantN!(24u)[]) to string
On Tue, Dec 10, 2013 at 6:54 AM, Dfr defle...@yandex.ru wrote:
Hello, here is example code, which doesn't work:
Variant[] vtypes = [ Variant(hello), Variant(bye) ];
string[] filetypes = map!(to!string)(vtypes);
Gives me error:
Error: cannot implicitly convert expression (map(vtypes
: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(PlayerLoginEvent).HandlerList
src\Event\Event.d(51): Error: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList
!(PlayerLoginEvent) {
int x;
}
src\Event\Event.d(41): Error: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(PlayerLoginEvent).HandlerList
src\Event\Event.d(51): Error: cannot implicitly convert
expression (handler_) of type
;
}
}
---
class PlayerLoginEvent : Event!(PlayerLoginEvent) {
int x;
}
src\Event\Event.d(41): Error: cannot implicitly convert
expression (handler_) of type shared(HandlerList) to
ghrum.event.HandlerList.HandlerList!(PlayerLoginEvent).HandlerList
src\Event\Event.d(51): Error: cannot
On Sat, 18 Sep 2010 17:20:31 -0400, Jonathan M Davis jmdavisp...@gmx.com
wrote:
On Saturday 18 September 2010 09:58:15 Steven Schveighoffer wrote:
In reality, you cannot make save const, unless you want to do a deep
copy
(but I recommend against that, save should be a quick operation).
On Monday, September 20, 2010 04:11:05 Steven Schveighoffer wrote:
You don't want a deep copy of a range. All you want to copy is the
iteration state, not the data.
save is definitely supposed to be shallow. I.e. you should copy the range
itself, not what the range points to.
That makes
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
I get the error message
d.d(5): Error: cannot implicitly convert expression (this) of type const(S) to S
If I remove const from save
Am Samstag, den 18.09.2010, 02:15 -0700 schrieb Jonathan M Davis:
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
Actually, wouldn't it be much more simple to just copy
implicitly convert expression (this) of type
const(S) to S
Yes, because you are converting this from a const(S) to an S to return
it.
Try:
@property const(S) save() const
{
return this;
}
If I remove const from save(), then it works, but with const there, it
doesn't.
If I change _val
On Saturday 18 September 2010 06:45:51 Ivo Kasiuk wrote:
Am Samstag, den 18.09.2010, 02:15 -0700 schrieb Jonathan M Davis:
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
Thanks for the help, folks.
CHICKZ
On 06/18/2010 12:25 AM, Chick Corea wrote:
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u
Chick Corea wrote:
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u] to int*
Error
On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea chick.zco...@gmail.com
wrote:
Those are the result of code that I pulled directly from the D v1 docs from
http://www.digitalmars.com/d/1.0/arrays.html
Specifically, the code is this.
int* p;
int[3] s;
int[] a;
Stewart Gordon wrote:
Chick Corea wrote:
[NOTE - sent twice as I was unsure that first attempt,
pre-subscription, was received.]
Working through the basics of D and running into simple problems that I
cannot solve, such as:
Error: cannot implicitly convert expression (s) of type int[3u
On Fri, 18 Jun 2010 08:41:17 -0700, Justin Spahr-Summers
justin.spahrsumm...@gmail.com wrote:
On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea chick.zco...@gmail.com
wrote:
Those are the result of code that I pulled directly from the D v1 docs from
38 matches
Mail list logo