Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
add std::move to optimize object construction
Browse files Browse the repository at this point in the history
also fix clang warning: no out-of-line virtual method definitions by
moving destructor definition to .cpp file. By the way, make the
destructor pure virtual to make it abstract class.
  • Loading branch information
sfraczek committed Jan 27, 2020
1 parent 35f9cb6 commit 93eb2c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/async_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class nervana::async_manager : public virtual nervana::async_manager_source<OUTP
{
public:
async_manager(std::shared_ptr<async_manager_source<INPUT>> source, const std::string& name)
: m_source(source)
: m_source(std::move(source))
, m_state{async_state::idle}
, m_name{name}
{
Expand Down
2 changes: 2 additions & 0 deletions src/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ using namespace nlohmann;

int IGNORE_VALUE;

nervana::interface::config_info_interface::~config_info_interface() {};

void json_configurable::verify_config(
const std::string& location,
const vector<shared_ptr<interface::config_info_interface>>& config,
Expand Down
2 changes: 1 addition & 1 deletion src/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace nervana
class nervana::interface::config_info_interface
{
public:
virtual ~config_info_interface() {}
virtual ~config_info_interface() = 0;
virtual const std::string& name() const = 0;
virtual void parse(nlohmann::json js) = 0;
virtual bool required() const = 0;
Expand Down

0 comments on commit 93eb2c2

Please sign in to comment.