From ba924a42bdb97faf48abfb071f22bcec4435ea0a Mon Sep 17 00:00:00 2001 From: Philip Cho Date: Wed, 31 Oct 2018 20:12:01 -0700 Subject: [PATCH] Fix compiler error + lint --- src/common/enum_class_param.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/enum_class_param.h b/src/common/enum_class_param.h index 7bb0c5748171..79134f6a3a21 100644 --- a/src/common/enum_class_param.h +++ b/src/common/enum_class_param.h @@ -14,9 +14,10 @@ // specialization of FieldEntry for enum class (backed by int) #define DECLARE_FIELD_ENUM_CLASS(EnumClass) \ +namespace dmlc { \ +namespace parameter { \ template <> \ -class dmlc::parameter::FieldEntry< EnumClass > \ - : public dmlc::parameter::FieldEntry { \ +class FieldEntry : public FieldEntry { \ public: \ FieldEntry() { \ static_assert( \ @@ -24,7 +25,7 @@ class dmlc::parameter::FieldEntry< EnumClass > \ "enum class must be backed by int"); \ is_enum_ = true; \ } \ - typedef FieldEntry Super; \ + using Super = FieldEntry; \ void Set(void *head, const std::string &value) const override { \ Super::Set(head, value); \ } \ @@ -37,9 +38,12 @@ class dmlc::parameter::FieldEntry< EnumClass > \ has_default_ = true; \ return *this; \ } \ + /* NOLINTNEXTLINE */ \ inline void Init(const std::string &key, void *head, EnumClass& ref) { \ Super::Init(key, head, *reinterpret_cast(&ref)); \ } \ -}; +}; \ +} /* namespace parameter */ \ +} /* namespace dmlc */ #endif // XGBOOST_COMMON_ENUM_CLASS_PARAM_H_