Mercurial > projects > dstress
diff run/i/inline_13_A.d @ 605:0f5c200f5c90
Post Pforzheim catch up 3
author | thomask |
---|---|
date | Thu, 21 Jul 2005 17:21:59 +0000 |
parents | |
children | b8c0195059d9 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/i/inline_13_A.d Thu Jul 21 17:21:59 2005 +0000 @@ -0,0 +1,47 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Uwe Salomon <post@uwesalomon.de> +// @date@ 2005-07-13 +// @uri@ news:op.studsoj86yjbe6@sandmann.maerchenwald.net + +module dstress.run.i.inline_13_A; + +struct NodeType(Key, T){ + NodeType* next; + uint hash; + Key key; +} + +struct HashIterator(Key, T){ + NodeType!(Key, T)* m_ptr; + + static HashIterator fromPtr(NodeType!(Key, T)* ptr){ + return *(cast(HashIterator*) &ptr); + } + + int opEquals(HashIterator iter){ + return (m_ptr == iter.m_ptr); + } +} + +struct Hash(Key, T){ + alias HashIterator!(Key, T) Iterator; + + Iterator end(){ + return Iterator.fromPtr(null); + } + +} + +int main(){ + Hash!(uint, uint) hash; + hash.Iterator iter; + + if ((iter = hash.end()) == hash.end){ + return 0; + } + + assert(0); +}