提交 a7865a37 编写于 作者: Y Yu Yang

Fix macos compile

Please use `override` not `virtual` in sub-classes.
`override` can check if there is a method in `parent` while compiling.
上级 93019df3
...@@ -309,35 +309,35 @@ public: ...@@ -309,35 +309,35 @@ public:
void addEvaluator(std::unique_ptr<Evaluator>&& evaluator) { void addEvaluator(std::unique_ptr<Evaluator>&& evaluator) {
evaluators_.emplace_back(std::move(evaluator)); evaluators_.emplace_back(std::move(evaluator));
} }
virtual void start() { void start() override {
for (auto& evaluator : evaluators_) { for (auto& evaluator : evaluators_) {
evaluator->start(); evaluator->start();
} }
} }
virtual void finish() { void finish() override {
for (auto& evaluator : evaluators_) { for (auto& evaluator : evaluators_) {
evaluator->finish(); evaluator->finish();
} }
} }
virtual void eval(const NeuralNetwork& nn) override { void eval(const NeuralNetwork& nn) override {
for (auto& evaluator : evaluators_) { for (auto& evaluator : evaluators_) {
evaluator->eval(nn); evaluator->eval(nn);
} }
} }
virtual real evalImp(std::vector<Argument>& arguments) { real evalImp(std::vector<Argument>& arguments) override {
(void)arguments; (void)arguments;
return -1; return -1;
} }
virtual void printStats(std::ostream& os) const { void printStats(std::ostream& os) const override {
for (auto& evaluator : evaluators_) { for (auto& evaluator : evaluators_) {
evaluator->printStats(os); evaluator->printStats(os);
os << ' '; os << ' ';
} }
} }
virtual void distributeEval(ParameterClient2* client) { void distributeEval(ParameterClient2* client) override {
for (auto& evaluator : evaluators_) { for (auto& evaluator : evaluators_) {
evaluator->distributeEval(client); evaluator->distributeEval(client);
} }
...@@ -352,7 +352,7 @@ public: ...@@ -352,7 +352,7 @@ public:
* @brief getNames will return all inside evaluators' names. * @brief getNames will return all inside evaluators' names.
* @param names [out]: return names. * @param names [out]: return names.
*/ */
void getNames(std::vector<std::string>* names) { void getNames(std::vector<std::string>* names) override {
for (auto& eval : evaluators_) { for (auto& eval : evaluators_) {
eval->getNames(names); eval->getNames(names);
} }
...@@ -361,7 +361,7 @@ public: ...@@ -361,7 +361,7 @@ public:
/** /**
* @brief getValue could get all inside evaluators' value. * @brief getValue could get all inside evaluators' value.
*/ */
real getValue(const std::string& name, Error* err) const { real getValue(const std::string& name, Error* err) const override {
return this->getMethodHelper<real>( return this->getMethodHelper<real>(
name, err, [&name, err](const std::unique_ptr<Evaluator>& eval) { name, err, [&name, err](const std::unique_ptr<Evaluator>& eval) {
return eval->getValue(name, err); return eval->getValue(name, err);
...@@ -371,7 +371,7 @@ public: ...@@ -371,7 +371,7 @@ public:
/** /**
* @brief getType could get all inside evaluators' type. * @brief getType could get all inside evaluators' type.
*/ */
std::string getType(const std::string& name, Error* err) const { std::string getType(const std::string& name, Error* err) const override {
return this->getMethodHelper<std::string>( return this->getMethodHelper<std::string>(
name, err, [&name, err](const std::unique_ptr<Evaluator>& eval) { name, err, [&name, err](const std::unique_ptr<Evaluator>& eval) {
return eval->getType(name, err); return eval->getType(name, err);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册