Question

When I use a std::deque as a private member in my class, I get lots of errors, like

/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;

and so on.

It works when I use a vector, but I want a pop_front functionality.

Any ideas?

EDIT:
Code:

#include <deque>
class Example {
    public:
        Example() {}
        ~Example() {}
    private:
        std::deque<std::string> m_deque;
};
Was it helpful?

Solution

You have to include #include <string>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top