fix up static, so works as DLL (#559)

* fix up static, so works as DLL
This commit is contained in:
dand-oss
2018-09-25 09:12:12 -05:00
committed by Jesse Beder
parent ca77ef716e
commit 774f25800e
3 changed files with 7 additions and 4 deletions

View File

@@ -81,7 +81,7 @@ class YAML_CPP_API node_data {
shared_memory_holder pMemory);
public:
static std::string empty_scalar;
static const std::string& empty_scalar();
private:
void compute_seq_size() const;

View File

@@ -156,13 +156,13 @@ inline T Node::as(const S& fallback) const {
inline const std::string& Node::Scalar() const {
if (!m_isValid)
throw InvalidNode();
return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar();
}
inline const std::string& Node::Tag() const {
if (!m_isValid)
throw InvalidNode();
return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar();
}
inline void Node::SetTag(const std::string& tag) {

View File

@@ -13,7 +13,10 @@
namespace YAML {
namespace detail {
std::string node_data::empty_scalar;
const std::string& node_data::empty_scalar() {
static const std::string svalue;
return svalue;
}
node_data::node_data()
: m_isDefined(false),