I am new to c++ and trying to understand the one-definition-rule. Will including the below test.h file in multiple c++ files voilate the one definition rule (syspath and tags). If not why not ?
#ifndef TEST_H
#define TEST_H_
#include <string>
#include <unordered_set>
namespace X {
class Test {
public:
// Default constructor.
Test();
~Test();
const std::string& syspath() const { return syspath_; }
const std::unordered_set<std::string> tags() const { return tags_;}
private:
std::string syspath_;
std::unordered_set<std::string> tags_;
};
} // namespace X
#endif // TEST_H_