使用std :: deque <std :: string>时出错

gar*_*ese 1 c++ string deque

当我在我的班级中使用std :: deque作为私人成员时,我会遇到很多错误,例如

/usr/include/c++/v1/deque:907:49: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >' static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;

/usr/include/c++/v1/deque:1181:30: error: '__alloc_traits' is a protected member of 'std::__1::__deque_base<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >' typedef typename __base::__alloc_traits __alloc_traits;

等等.

它在我使用矢量时有效,但我想要一个pop_front功能.

有任何想法吗?

编辑:
代码:

#include <deque>
class Example {
    public:
        Example() {}
        ~Example() {}
    private:
        std::deque<std::string> m_deque;
};
Run Code Online (Sandbox Code Playgroud)

Seb*_*ann 5

你必须包括 #include <string>