#ifndef VCZH_COLLECTIONS_FOREACH
#define VCZH_COLLECTIONS_FOREACH
#include "../Basic.h"
#include "../Pointer.h"
#include "Interfaces.h"
namespace
{
namespace
{
template
<
typename
>
class
:
public
{
public
:
virtual
bool
(
&
)
const
=
0
;
bool
()
const
{
return
true
;
}
};
template
<
typename
>
class
EnumerableForEachIterator
:
public
<
>
{
protected
:
<
<
>>
;
public
:
EnumerableForEachIterator
(
const
<
>&
)
:enumerator(
.
())
{
}
EnumerableForEachIterator
(
const
EnumerableForEachIterator
<
>&
)
:enumerator(
.
)
{
}
bool
(
&
)
const
{
if
(
())
{
=
();
return
true
;
}
else
{
return
false
;
}
}
};
template
<
typename
>
EnumerableForEachIterator
<
>
(
const
<
>&
)
{
return
;
}
#define FOREACH(TYPE, VARIABLE, COLLECTION)\
SCOPE_VARIABLE(const ::vl::collections::ForEachIterator<TYPE>&, __foreach_iterator__, ::vl::collections::CreateForEachIterator(COLLECTION))\
for(TYPE VARIABLE;__foreach_iterator__.Next(VARIABLE);)
#define FOREACH_INDEXER(TYPE, VARIABLE, INDEXER, COLLECTION)\
SCOPE_VARIABLE(const ::vl::collections::ForEachIterator<TYPE>&, __foreach_iterator__, ::vl::collections::CreateForEachIterator(COLLECTION))\
SCOPE_VARIABLE(vint, INDEXER, 0)\
for(TYPE VARIABLE;__foreach_iterator__.Next(VARIABLE);INDEXER++)
}
}
#endif