www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot understand some codes in std.concurrency.

In concurrency.d (version 2.055, line 1247 - 1250) , there's some codes
related to internal implementation of List(T).

"
 Range opSlice()
        {
            return Range( cast(Node*) &m_first );
        }
"

What does this mean? m_first itself is Node *, then &m_first is Node **,
then we cast it back to (Node *)? Does it make sense?

If we change "&m_first" to "m_first", it still is weird, because in line
1169:
"
  property bool empty() const
            {
                return !m_prev.next;
            }
"

The list is empty when m_first is null, that is m_prev is null, not
m_prev.next is null.

Is my understanding of these codes completely wrong, or it is a bug in the
code?

Thanks.
Sep 14 2011