top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can not find shrink_to_fit() in c++

0 votes

I have been trying to use the C++ STL vector that is given in the header using gcc-4.7.2. However, when I tried using the function shrink_to_fit() using an object of a vector, I got an error saying :

‘class std::vector’ has no member named ‘shrink_to_fit’

where cs_dfa is a structure that I have declared.

posted May 30, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
Best answer

You need -std=c++11 or gnu++11 since this is a new C++11 feature.

answer May 30, 2013 by anonymous
Similar Questions
+7 votes

int &fun()
   static int x;
   return x;

int main()
   fun() = 10;
   printf(" %d ", fun());

   return 0;

It is fine with c++ compiler while giving error with c compiler.

+2 votes

How to find the smallest element in a Binary Tree (Not BST)? Sample C/C++ code would be helpful.

0 votes

Find the first non repeating character in a string.

For example
Input string: "abcdeabc"
Output: "e"