msg[0] or msg.field[0] ?
SK
sk at metrokings.com
Sun Aug 29 09:59:18 PDT 2010
>From the concurrency chapter, TDPL states that tuple fields are accessed
with the [] operator, as in:
***void* writer() {
*for* (;;) {
*auto* msg = receiveOnly!(Tid, *int*)();
writeln("Secondary thread: ", msg[1]);
msg[0].send(thisTid);
}
}
However, for me this code returns compile time errors like this:
Error: no [] operator overload for type Tuple!(Tid,uint)
If I add .field to the tuple access, it compiles fine:
***void* writer() {
*for* (;;) {
*auto* msg = receiveOnly!(Tid, *int*)();
writeln("Secondary thread: ", msg.field[1]);
msg.field[0].send(thisTid);
}
}
What is the explanation?
Thanks,
-steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100829/8bb8753a/attachment-0001.html>
More information about the Digitalmars-d-learn
mailing list