On 3/8/16 10:04 PM, Jack Stouffer wrote:
On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot any mistakes, please let me
On Wednesday, 9 March 2016 at 22:54:13 UTC, bigsandwich wrote:
Yes, I do. std::function<> uses type erasure to store a
"function". If its small enough, its stored internally,
otherwise it goes on the heap.
Yes, I believe that is said to be the common implementation, but
people also claim
On Thursday, 10 March 2016 at 00:31:00 UTC, John Colvin wrote:
what magic is this? I had no idea that taking the address of
opCall would give me a delegate.
opCall is a red herring: taking the address of *any* non-static
member function in a class or struct object will give you a
delegate.
On Wednesday, 9 March 2016 at 20:14:13 UTC, Adam D. Ruppe wrote:
---
import std.stdio;
@nogc int delegate(int) dg;
int helper() @nogc {
int a = 50;
struct MyFunctor {
int a;
@nogc this(int a) { this.a = a; }
// the function
On Wednesday, 9 March 2016 at 22:54:13 UTC, bigsandwich wrote:
On Wednesday, 9 March 2016 at 22:05:28 UTC, Ola Fosheim Grøstad
wrote:
[...]
Yes, I do. std::function<> uses type erasure to store a
"function". If its small enough, its stored internally,
otherwise it goes on the heap. It
On Wednesday, 9 March 2016 at 22:05:28 UTC, Ola Fosheim Grøstad
wrote:
On Wednesday, 9 March 2016 at 20:41:35 UTC, bigsandwich wrote:
Right, I used to this sort of thing in C++ prior to C++11. I
think not having an RAII wrapper for lambdas similar to
std::function<> is an oversight for D,
On Wednesday, 9 March 2016 at 20:41:35 UTC, bigsandwich wrote:
Right, I used to this sort of thing in C++ prior to C++11. I
think not having an RAII wrapper for lambdas similar to
std::function<> is an oversight for D, especially for people
averse to GC. That little bit of syntactic sugar
On Wednesday, 9 March 2016 at 20:14:13 UTC, Adam D. Ruppe wrote:
On Wednesday, 9 March 2016 at 18:26:01 UTC, bigsandwich wrote:
[...]
You can easily do it yourself with a struct. That's all the c++
lambda is anyway, a bit of syntax sugar over a struct.
[...]
Right, I used to this sort
On Wednesday, 9 March 2016 at 18:26:01 UTC, bigsandwich wrote:
As far as I know capturing other variables requires the GC in D.
You can easily do it yourself with a struct. That's all the c++
lambda is anyway, a bit of syntax sugar over a struct.
Then you pass the struct itself if you want
On Wednesday, 9 March 2016 at 18:26:01 UTC, bigsandwich wrote:
Is this really true? Couldn't the closure be stored internally
somewhere like std::function<> does in C++?
Lambdas in C++ creates a regular class with a call-operator, the
class is instantiated and the fields filled with the
On Wednesday, 9 March 2016 at 18:26:01 UTC, bigsandwich wrote:
On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
[...]
C++ as well as D have anonymous functions. C++: [](auto a, auto
b){ return a + b;} , D: (a, b) => a + b or (a, b){return a +
b;}. As far as I know capturing
On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot any mistakes, please let me know.
I'm missing the wildcard
On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot any mistakes, please let me know.
C++ as well as D have anonymous
On 03/08/2016 08:18 PM, maik klein wrote:
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot any mistakes, please let me know.
Nice work, thanks! -- Andrei
On Wednesday, 9 March 2016 at 04:37:47 UTC, maik klein wrote:
Does this mean I could do any cast at compile time?
No, compile time has other restrictions.
http://dlang.org/spec/function.html#interpretation
"Any pointer may be cast to void * and from void * back to its
original type. Casting
On Wednesday, 9 March 2016 at 04:15:39 UTC, Walter Bright wrote:
On 3/8/2016 6:14 PM, Chris Wright wrote:
D does not let you downcast without a runtime check.
You can by casting to void* first, then the downcast.
Thanks I'll update the post later. Does this mean I could do any
cast at
On 3/8/2016 6:14 PM, Chris Wright wrote:
D does not let you downcast without a runtime check.
You can by casting to void* first, then the downcast.
On Wednesday, 9 March 2016 at 03:04:31 UTC, Jack Stouffer wrote:
On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot
On Wednesday, 9 March 2016 at 01:18:26 UTC, maik klein wrote:
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot any mistakes, please let me know.
D moves objects with a bitwise
On Wednesday, 9 March 2016 at 02:14:34 UTC, Chris Wright wrote:
On Wed, 09 Mar 2016 01:18:26 +, maik klein wrote:
[...]
[...]
Rather, declaring a variable should never throw an exception.
Declaring a variable shouldn't create any nontrivial work.
It's trivial to create a type in D
On Wed, 09 Mar 2016 01:18:26 +, maik klein wrote:
> If you spot any mistakes, please let me know.
> structs in D don’t have a default constructor because every type
> needs exception free default construction
Rather, declaring a variable should never throw an exception. Declaring a
variable
Direct link: https://maikklein.github.io/post/CppAndD/
Reddit link:
https://www.reddit.com/r/programming/comments/49lna6/a_comparison_between_c_and_d/
If you spot any mistakes, please let me know.
22 matches
Mail list logo