1 // stack stl/clr header
2 #ifndef _CLI_STACK_
3  #define _CLI_STACK_
4 #include <cliext/deque>    // for default stack container
5 #include <cliext/iterator>
6
7 namespace cliext {
8     namespace impl {
9 //
10 // TEMPLATE CLASS stack_base
11 //
12 template<typename _Value_t,
13     typename _Cont_t>
14     ref class stack_base
15     :    public _STLCLR IStack<_Value_t,
16         typename _Container_traits<_Cont_t>::generic_container_handle>
17     {    // LIFO queue of elements
18 public:
19     // types
20     typedef stack_base<_Value_t, _Cont_t> _Mytype_t;
21     typedef _STLCLR IStack<_Value_t,
22         typename _Container_traits<_Cont_t>::generic_container_handle> _Mycont_it;
23     typedef cli::array<_Value_t> _Myarray_t;
24
25     typedef int size_type;
26     typedef int difference_type;
27     typedef _Value_t value_type;
28     typedef value_type% reference;
29     typedef value_type% const_reference;
30
31     typedef _Mycont_it generic_container;
32     typedef value_type generic_value;
33
34     typedef typename _Dehandle<_Cont_t>::type container_type;
35
36     // basics
37     stack_base()
38         :    c(gcnew container_type)
39         {    // default constructor
40         }
41
42     stack_base% operator=(stack_base% _Right)
43         {    // assign
44         assign(_Right);
45         return (*this);
46         }
47
48     operator _Mycont_it^()
49         {    // convert to interface
50         return (this);
51         }
52
53     // constructors
Lines 54 ... 375 are skipped.
376     }
377
378 template<typename _Value_t,
379     typename _Cont_t>
380     bool operator!=(stack<_Value_t, _Cont_t>% _Left,
381         stack<_Value_t, _Cont_t>% _Right)
382     {    // test if _Left != _Right
383     return (!(_Left == _Right));
384     }
385
386 template<typename _Value_t,
387     typename _Cont_t>
388     bool operator<(stack<_Value_t, _Cont_t>% _Left,
389         stack<_Value_t, _Cont_t>% _Right)
390     {    // test if _Left < _Right
391     return (*_Left.get_container() < *_Right.get_container());
392     }
393
394 template<typename _Value_t,
395     typename _Cont_t>
396     bool operator>=(stack<_Value_t, _Cont_t>% _Left,
397         stack<_Value_t, _Cont_t>% _Right)
398     {    // test if _Left >= _Right
399     return (!(_Left < _Right));
400     }
401
402 template<typename _Value_t,
403     typename _Cont_t>
404     bool operator>(stack<_Value_t, _Cont_t>% _Left,
405         stack<_Value_t, _Cont_t>% _Right)
406     {    // test if _Left > _Right
407     return (_Right < _Left);
408     }
409
410 template<typename _Value_t,
411     typename _Cont_t>
412     bool operator<=(stack<_Value_t, _Cont_t>% _Left,
413         stack<_Value_t, _Cont_t>% _Right)
414     {    // test if _Left <= _Right
415     return (!(_Right < _Left));
416     }
417 }    // namespace cliext
418 #endif // _CLI_STACK_
419
420 /*
421  * Copyright (c) 2004-2007 by Dinkumware, Ltd.  ALL RIGHTS RESERVED.
422  * Consult your license regarding permissions and restrictions.
423 V5.03:0009 */
424