【问题标题】:c++ symbol _ZNSsC2ERKSsjjc++ 符号_ZNSsC2ERKSsjj
【发布时间】:2015-05-15 19:49:21
【问题描述】:

我的应用程序在 c++ 符号 _ZNSsC2ERKSsjj 处崩溃。 我使用 c++filt 找到符号如下。

# c++filt _ZNSsC2ERKSsjj

std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)

这个符号是什么意思?

【问题讨论】:

    标签: c++ symbols


    【解决方案1】:

    std::string 的构造函数接受一个const std::string& 和两个unsigned ints (ref):

    basic_string( const basic_string& other, 
                  size_type pos, 
                  size_type count = std::basic_string::npos,
                  const Allocator& alloc = Allocator() );
    

    (您的实现是合规地用一对重载替换可选参数设计,没有分配器参数的那个就是您在此处看到的那个。)

    你几乎肯定会超出输入字符串的范围,如果它首先是一个有效的字符串。

    【讨论】:

    • IIRC 实现用重载对替换默认参数是有效的。
    【解决方案2】:

    std::string constructor 占据两个位置(无符号整数)。这构造了参数的子字符串。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-24
      • 2014-01-27
      • 2012-10-20
      相关资源
      最近更新 更多