top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Can not find shrink_to_fit() in c++

0 votes
296 views

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 Google+ Share Button LinkedIn Share Button Multiple Social 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
#include<stdio.h>

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.


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...