On Monday, 16 September 2013 at 07:36:13 UTC, simendsjo wrote:
I don't have a full example without adding a lot of code, but
this partial
example might give you the gist of it.
// This is the type that validates
struct matches(string mustMatch)
{
alias re = ctRegex!(mustMatch);
static
On 2013-09-20 08:59, ilya-stromberg wrote:
Can I explicitly specify when I can use attribute? Something like
this:
@attribute("field")
struct matches(string mustMatch)
{
}
string wrongAttribute
{
}
class Foo
{
@matches("[0-9]+")
string someNumber; //OK, it's a field
}
@matches("[0-
Remove the "ref" in "ref A opAdd(const ref A a) {"
Running this code I would expect to get "ref" three times, but ...
---
import std.stdio;
struct A {
int[128] data;
ref A opAdd(const ref A a) {
A cp = this;
cp.data[] += a.data[];
return cp;
}
}
void fun(A a) { writeln("
On Friday, 20 September 2013 at 09:36:18 UTC, andrea9940 wrote:
Running this code I would expect to get "ref" three times, but
...
---
import std.stdio;
struct A {
int[128] data;
ref A opAdd(const ref A a) {
A cp = this;
cp.data[] += a.data[];
On Friday, 20 September 2013 at 09:44:51 UTC, Namespace wrote:
This prints 'ref' if you change func(A a) to func(const A a)
the match of const ref isn't prefered over A a because const
need an implicit conversion.
Thanks for the tip.
a + b is an rvalue and will moved to func(A a). This is eve
On Friday, 20 September 2013 at 10:29:24 UTC, andrea9940 wrote:
On Friday, 20 September 2013 at 09:44:51 UTC, Namespace wrote:
This prints 'ref' if you change func(A a) to func(const A a)
the match of const ref isn't prefered over A a because const
need an implicit conversion.
Thanks for the
Output:
CTor A with 42
CTor A with 23
CTor A with 65
Value call with A::65
DTor A with 65
CTor A with 1337
Value call with A::1337
DTor A with 1337
Ref call with A::42
DTor A with 23
DTor A with 42
No Postblit call.
The beahvior is correct but at assembly level the compiler still
cre
On Friday, 20 September 2013 at 06:20:09 UTC, Ali Çehreli wrote:
On 09/19/2013 04:32 AM, Dicebot wrote:
> Some obvious catches:
Thank you. I have made those changes except the following one.
> Variadic template arg chapter should probably mention
"variadic args of
> length 1" idiom used to hav
On Friday, 20 September 2013 at 07:57:43 UTC, Jacob Carlborg
wrote:
On 2013-09-20 08:59, ilya-stromberg wrote:
Can I explicitly specify when I can use attribute? Something
like
this:
@attribute("field")
struct matches(string mustMatch)
{
}
string wrongAttribute
{
}
class Foo
{
@matches(
20.09.2013 12:45, Ali Çehreli пишет:
On 09/19/2013 10:31 PM, Alexandr Druzhinin wrote:
> if I use protected instead of private in interface like:
private member functions are non-virtual.
But I just use code example from TDPL russian edition. And TDPL says
clearly that (un)transmogrify() are
On Friday, September 20, 2013 22:40:48 Alexandr Druzhinin wrote:
> 20.09.2013 12:45, Ali Çehreli пишет:
> > On 09/19/2013 10:31 PM, Alexandr Druzhinin wrote:
> > > if I use protected instead of private in interface like:
> > private member functions are non-virtual.
>
> But I just use code exampl
20.09.2013 23:09, Jonathan M Davis пишет:
You can use NVI with classes just fine just so long as you use protected rather
than private, but making it private there won't work either, because private
is never virtual (and it wouldn't really help you any if it were, because
while the base class pri
13 matches
Mail list logo