Я не могу скомпилировать yaml-cpp
в RAD Studio 2010. У меня ошибка в nodeutil.h
template <typename T, typename U>
struct is_same_type {
enum { value = false };
};
template <typename T>
struct is_same_type<T, T> {
enum { value = true };
};
template <typename T, bool check>
struct is_index_type_with_check {
enum { value = false };
};
template <> struct is_index_type_with_check<std::size_t, false>
{ enum { value = true }; }; // line 24
#define MAKE_INDEX_TYPE(Type) \
template <> struct is_index_type_with_check<Type, is_same_type<Type, std::size_t>::value> { enum { value = true }; }
MAKE_INDEX_TYPE(int);
MAKE_INDEX_TYPE(unsigned); // line 30
MAKE_INDEX_TYPE(short);
MAKE_INDEX_TYPE(unsigned short);
MAKE_INDEX_TYPE(long);
MAKE_INDEX_TYPE(unsigned long);
#undef MAKE_INDEX_TYPE
Печать компилятора:
[BCC32 Error] nodeutil.h(30): E2238 Multiple declaration for 'is_index_type_with_check<unsigned int,0>'
[BCC32 Error] nodeutil.h(24): E2344 Earlier declaration of 'is_index_type_with_check<unsigned int,0>'
Я думаю, что все правильно - в строке 24 я получил
is_index_type_with_check<std::size_t, false>
,
в строке 30 я получил
is_index_type_with_check<unsigned, true>
.
Два разных типа.
Но если я изменю строку 24, как показано ниже, RAD Studio может скомпилировать yaml-cpp
template <> struct is_index_type_with_check<std::size_t, true> { enum { value = true }; }; // false -> true
Почему ?! В строке 24 я получил
is_index_type_with_check<std::size_t, true>
и в строке 30
is_index_type_with_check<unsigned, true>
Два одинаково типа. Но все работает в RAD Studio, а не в MS VS 2008 Express.