1 /******************************************************************************* 2 3 copyright: Copyright (c) 2008 Kris Bell. All rights reserved 4 5 license: BSD style: $(LICENSE) 6 7 version: Apr 2008: Initial release 8 9 authors: Kris 10 11 Since: 0.99.7 12 13 *******************************************************************************/ 14 15 module tango.util.container.model.IContainer; 16 17 /******************************************************************************* 18 19 Generic container 20 21 *******************************************************************************/ 22 23 interface IContainer (V) 24 { 25 const size_t size (); 26 27 const bool isEmpty (); 28 29 IContainer dup (); 30 31 IContainer clear (); 32 33 IContainer reset (); 34 35 IContainer check (); 36 37 bool contains (V value); 38 39 bool take (ref V element); 40 41 V[] toArray (V[] dst = null); 42 43 size_t remove (V element, bool all); 44 45 int opApply (scope int delegate(ref V value) dg); 46 47 size_t replace (V oldElement, V newElement, bool all); 48 } 49 50 51 /******************************************************************************* 52 53 Comparator function 54 55 *******************************************************************************/ 56 57 template Compare (V) 58 { 59 alias int function (ref V a, ref V b) Compare; 60 } 61