|
|
|
1 |
|
// adapter stl/clr header |
2 |
|
#ifndef _CLI_ADAPTER_ |
3 |
|
#define _CLI_ADAPTER_ |
4 |
|
#include <cliext/iterator> |
5 |
|
#include <cliext/utility> |
6 |
|
|
7 |
|
namespace cliext { |
8 |
|
// |
9 |
|
// TEMPLATE CLASS collection_adapter |
10 |
|
// |
11 |
|
template<typename _Cont_t> |
12 |
|
ref class collection_adapter; |
13 |
|
|
14 |
|
// |
15 |
|
// TEMPLATE REF CLASS Enum_iterator |
16 |
|
// |
17 |
|
template<typename _Cont_t, |
18 |
|
typename _Enum_t, |
19 |
|
typename _Value_t> |
20 |
|
ref class Enum_iterator |
21 |
|
{ // iterator for read-only one-pass container |
22 |
|
public: |
23 |
|
// types |
24 |
|
typedef Enum_iterator<_Cont_t, _Enum_t, _Value_t> _Mytype_t; |
25 |
|
|
26 |
|
typedef input_iterator_tag iterator_category; |
27 |
|
typedef _Value_t value_type; |
28 |
|
typedef int difference_type; |
29 |
|
typedef value_type% pointer; |
30 |
|
typedef value_type% reference; |
31 |
|
typedef value_type% const_reference; |
32 |
|
|
33 |
|
// basics |
34 |
|
Enum_iterator() |
35 |
|
: _Mycont(nullptr), _Myenum(nullptr) |
36 |
|
{ // construct default |
37 |
|
} |
38 |
|
|
39 |
|
Enum_iterator(Enum_iterator% _Right) |
40 |
|
: _Mycont(_Right._Mycont), _Myenum(_Right._Myenum) |
41 |
|
{ // construct by copying an iterator |
42 |
|
} |
43 |
|
|
44 |
|
Enum_iterator% operator=(Enum_iterator% _Right) |
45 |
|
{ // assign an iterator |
46 |
|
_Mycont = _Right._Mycont; |
47 |
|
_Myenum = _Right._Myenum; |
48 |
|
return (*this); |
49 |
|
} |
50 |
|
|
51 |
|
// constructors |
52 |
|
Enum_iterator(_Cont_t^ _Cont) |
53 |
|
: _Mycont(_Cont), _Myenum(nullptr) |
1440 |
|
: _Mybase_t() |
1441 |
|
{ // default constructor |
1442 |
|
} |
1443 |
|
|
1444 |
|
range_adapter(range_adapter% _Right) |
1445 |
|
: _Mybase_t(_Right) |
1446 |
|
{ // construct by copying _Right |
1447 |
|
} |
1448 |
|
|
1449 |
|
range_adapter(range_adapter^ _Right) |
1450 |
|
: _Mybase_t(*_Right) |
1451 |
|
{ // construct by copying _Right |
1452 |
|
} |
1453 |
|
|
1454 |
|
range_adapter% operator=(range_adapter% _Right) |
1455 |
|
{ // assign |
1456 |
|
_Mybase_t::operator=(_Right); |
1457 |
|
return (*this); |
1458 |
|
} |
1459 |
|
|
1460 |
|
range_adapter% operator=(range_adapter^ _Right) |
1461 |
|
{ // assign |
1462 |
|
_Mybase_t::operator=(*_Right); |
1463 |
|
return (*this); |
1464 |
|
} |
1465 |
|
|
1466 |
|
// constructors |
1467 |
|
range_adapter(_Iter_t _First, _Iter_t _Last) |
1468 |
|
: _Mybase_t(_First, _Last) |
1469 |
|
{ // construct from [_First, _Last) |
1470 |
|
} |
1471 |
|
}; |
1472 |
|
|
1473 |
|
// |
1474 |
|
// TEMPLATE FUNCTION make_collection |
1475 |
|
// |
1476 |
|
template<typename _Iter_t> inline |
1477 |
|
range_adapter<_Iter_t>^ make_collection(_Iter_t _First, _Iter_t _Last) |
1478 |
|
{ // wrap an iterator pair |
1479 |
|
return (gcnew range_adapter<_Iter_t>(_First, _Last)); |
1480 |
|
} |
1481 |
|
} // namespace cliext |
1482 |
|
#endif // _CLI_ADAPTER_ |
1483 |
|
|
1484 |
|
/* |
1485 |
|
* Copyright (c) 2004-2007 by Dinkumware, Ltd. ALL RIGHTS RESERVED. |
1486 |
|
* Consult your license regarding permissions and restrictions. |
1487 |
|
V5.03:0009 */ |
1488 |
|
|
|
|
|