, 나는 정의하려면 몇 가지 로컬이 아닌 다른 클래스, 함수, 파일, 내가 알고 접근 방법에서 사용할 수있는 const를 문자열 : 사용 지침을 정의, 예를 들어, #define STR_VALUE "some_string_value"
const 클래스 멤버 변수 class Demo {
public:
static const std::string
나쁘지는 않지만 const_string lib를 시도하고 있는데 런타임에 액세스 위반 (atomic_count, 연산자 ++())으로 인해 충돌합니다. 테스트 코드 : #include <boost/const_string/const_string.hpp>
#include <boost/const_string/concatenation.hpp>
typedef
은 이제 나는 다음과 POC 코드가 있다고 가정 해 봅시다 : const string& a = "hello";
string b = "l";
if(a.at(2) == b)
{
// do stuff
}
나는이 피연산자와 일치하는 연산자 "=="가 없다는 것을 잘 알고 있습니다. 그리고 그것을 수정하는 방법은 변수 a의 값을 'hello'(큰 따옴