|
|
|
1 |
|
// vector stl/clr header |
2 |
|
#ifndef _CLI_VECTOR_ |
3 |
|
#define _CLI_VECTOR_ |
4 |
|
#include <cliext/iterator> |
5 |
|
|
6 |
|
namespace cliext { |
7 |
|
namespace impl { |
8 |
|
// |
9 |
|
// TEMPLATE CLASS vector_impl |
10 |
|
// |
11 |
|
template<typename _Value_t, |
12 |
|
bool _Is_ref> |
13 |
|
ref class vector_impl |
14 |
|
: public _STLCLR IVector<_Value_t> |
15 |
|
{ // varying size array of elements |
16 |
|
public: |
17 |
|
// types |
18 |
|
typedef vector_impl<_Value_t, _Is_ref> _Mytype_t; |
19 |
|
typedef _STLCLR IVector<_Value_t> _Mycont_it; |
20 |
|
typedef cli::array<_Value_t> _Myarray_t; |
21 |
|
typedef System::Collections::Generic::IEnumerable<_Value_t> _Myenum_it; |
22 |
|
typedef _Cont_make_value<_Value_t, _Is_ref> _Mymake_t; |
23 |
|
|
24 |
|
typedef RandomAccessIterator<_Mytype_t> |
25 |
|
iterator; |
26 |
|
typedef ConstRandomAccessIterator<_Mytype_t> |
27 |
|
const_iterator; |
28 |
|
typedef ReverseRandomAccessIterator<_Mytype_t> |
29 |
|
reverse_iterator; |
30 |
|
typedef ReverseRandomAccessIterator<_Mytype_t> |
31 |
|
const_reverse_iterator; |
32 |
|
|
33 |
|
typedef int size_type; |
34 |
|
typedef int difference_type; |
35 |
|
typedef _Value_t value_type; |
36 |
|
typedef value_type% reference; |
37 |
|
typedef value_type% const_reference; |
38 |
|
|
39 |
|
typedef _Mycont_it generic_container; |
40 |
|
typedef value_type generic_value; |
41 |
|
typedef _STLCLR Generic::ContainerRandomAccessIterator<_Value_t> |
42 |
|
generic_iterator; |
43 |
|
typedef _STLCLR Generic::ReverseRandomAccessIterator<_Value_t> |
44 |
|
generic_reverse_iterator; |
45 |
|
|
46 |
|
// constants |
47 |
|
static const int _Maxsize = MAX_CONTAINER_SIZE; |
48 |
|
|
49 |
|
// basics |
50 |
|
vector_impl() |
51 |
|
{ // construct empty vector |
52 |
|
_Buy(0); |
53 |
|
} |
1426 |
|
{ // test if _Left < _Right |
1427 |
|
vector<_Value_t>::size_type _Idx = 0; |
1428 |
|
|
1429 |
|
for (; _Idx != _Left.size() && _Idx != _Right.size(); ++_Idx) |
1430 |
|
if (_Left.at(_Idx) < _Right.at(_Idx)) |
1431 |
|
return (true); |
1432 |
|
else if (_Right.at(_Idx) < _Left.at(_Idx)) |
1433 |
|
return (false); |
1434 |
|
return (_Idx == _Left.size() && _Idx != _Right.size()); |
1435 |
|
} |
1436 |
|
|
1437 |
|
template<typename _Value_t> inline |
1438 |
|
bool operator>=(vector<_Value_t>% _Left, |
1439 |
|
vector<_Value_t>% _Right) |
1440 |
|
{ // test if _Left >= _Right |
1441 |
|
return (!(_Left < _Right)); |
1442 |
|
} |
1443 |
|
|
1444 |
|
template<typename _Value_t> inline |
1445 |
|
bool operator>(vector<_Value_t>% _Left, |
1446 |
|
vector<_Value_t>% _Right) |
1447 |
|
{ // test if _Left > _Right |
1448 |
|
return (_Right < _Left); |
1449 |
|
} |
1450 |
|
|
1451 |
|
template<typename _Value_t> inline |
1452 |
|
bool operator<=(vector<_Value_t>% _Left, |
1453 |
|
vector<_Value_t>% _Right) |
1454 |
|
{ // test if _Left <= _Right |
1455 |
|
return (!(_Right < _Left)); |
1456 |
|
} |
1457 |
|
|
1458 |
|
// |
1459 |
|
// TEMPLATE FUNCTION std::swap |
1460 |
|
// |
1461 |
|
template<typename _Value_t> inline |
1462 |
|
void swap(vector<_Value_t>% _Left, |
1463 |
|
vector<_Value_t>% _Right) |
1464 |
|
{ // swap two vectors |
1465 |
|
_Left.swap(_Right); |
1466 |
|
} |
1467 |
|
} // namespace cliext |
1468 |
|
#endif // _CLI_VECTOR_ |
1469 |
|
|
1470 |
|
/* |
1471 |
|
* Copyright (c) 2004-2007 by Dinkumware, Ltd. ALL RIGHTS RESERVED. |
1472 |
|
* Consult your license regarding permissions and restrictions. |
1473 |
|
V5.03:0009 */ |
1474 |
|
|
|
|
|