13#ifndef ML_CONSTANT_STRING_H
14#define ML_CONSTANT_STRING_H
20#include <ThirdPartyWarningsDisable.h>
22#include <boost/functional/hash.hpp>
23#include <ThirdPartyWarningsRestore.h>
44 boost::hash<std::string>
hasher;
87 _value->incRefCount();
95 _value =
other._value;
97 _value->incRefCount();
103 if (_value !=
other._value) {
105 _value->decRefCount();
107 _value =
other._value;
109 _value->incRefCount();
117 _value->decRefCount();
124 return toString() <
other.toString();
129 if (
other._value == _value) {
134 if (_value &&
other._value) {
136 if (_value->getHash() ==
other._value->getHash()) {
138 return _value->_value ==
other._value->_value;
144 else if (!_value && !
other._value) {
155 operator std::string()
const
158 return _value->_value;
161 return std::string();
165 operator const std::string&()
const
168 return _value->_value;
178 return _value->_value;
187 return _value ==
nullptr;
193 return _value->getHash();
Shared container for the string value and its hash.
ConstantStringValue(const std::string &value)
A ConstantString that contains a std::string and its hash.
ConstantString(const std::string &value)
bool operator==(const ConstantString &other) const
void operator=(const ConstantString &other)
ConstantString(const ConstantString &other)
bool operator<(const ConstantString &other) const
const std::string & toString() const
size_t hash_value(MLGlobalFunctionKey const &key)
Calculates the hash key from last string segment.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.