|
// This file is part of EnumeratorLib
// Copyright: Andreas Raczek
// This file is published under the The Code Project Open License (CPOL)
// See the file "CPOL.html" for the full license governing this code.
#pragma once
namespace lobster {
namespace enm {
template<typename enum_array, int index> struct _at_rt;
template<
typename enum_array, int index>
struct _at_rt {
typedef typename copy_const<typename enum_array, typename enum_array::value_type>::type value_type;
typedef typename copy_const<typename enum_array, typename enum_array::parent_array>::type parent_array;
inline static value_type& value(enum_array& arr, typename enum_array::enum_type enum_value_test) {
return enum_value_test == enum_array::enum_value ?
arr._value
:
_at_rt<parent_array, parent_array::size-1>::value(arr, enum_value_test);
}
};
template<
typename enum_array>
struct _at_rt <
enum_array,
0
> {
typedef typename copy_const<typename enum_array, typename enum_array::value_type>::type value_type;
inline static value_type& value(enum_array& arr, typename enum_array::enum_type enum_value_test) {
if (enum_value_test != enum_array::enum_value) {
throw std::out_of_range("_at");
}
return arr._value;
}
};
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.