Cosmetics [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2017-07-03 21:29:56 +03:00
parent c170b6f0d2
commit 15cf838250

View File

@ -51,27 +51,23 @@ std::string DataTypeEnum<Type>::generateName(const Values & values)
template <typename Type>
void DataTypeEnum<Type>::fillMaps()
{
for (const auto & name_and_value : values )
for (const auto & name_and_value : values)
{
const auto name_to_value_pair = name_to_value_map.insert(
{ StringRef{name_and_value.first}, name_and_value.second });
if (!name_to_value_pair.second)
throw Exception{
"Duplicate names in enum: '" + name_and_value.first + "' = " + toString(name_and_value.second)
+ " and '" + name_to_value_pair.first->first.toString() + "' = " + toString(
name_to_value_pair.first->second),
ErrorCodes::SYNTAX_ERROR
};
+ " and '" + name_to_value_pair.first->first.toString() + "' = " + toString(name_to_value_pair.first->second),
ErrorCodes::SYNTAX_ERROR};
const auto value_to_name_pair = value_to_name_map.insert(
{ name_and_value.second, StringRef{name_and_value.first} });
if (!value_to_name_pair.second)
throw Exception{
"Duplicate values in enum: '" + name_and_value.first + "' = " + toString(name_and_value.second)
+ " and '" + value_to_name_pair.first->second.toString() + "' = " + toString(
value_to_name_pair.first->first),
ErrorCodes::SYNTAX_ERROR
};
+ " and '" + value_to_name_pair.first->second.toString() + "' = " + toString(value_to_name_pair.first->first),
ErrorCodes::SYNTAX_ERROR};
}
}