Thread: Somewhat confused about C++11 and the new library function for conversion of string..

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    178

    Somewhat confused about C++11 and the new library function for conversion of string..

    and literals. I was looking for stod() for example in MinGW includes and have not found it under std::

    Anyone have an exampled of how they are used?

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Are you sure your version of g++ used by MinGW is C++11 compliant?

    Here is a link to some documentation for these functions: std::stof.

    Jim

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    178
    Quote Originally Posted by jimblumberg View Post
    Are you sure your version of g++ used by MinGW is C++11 compliant?

    Here is a link to some documentation for these functions: std::stof.

    Jim
    std::stod and similar library methods I am unable to find using MinGW and having MinGW lib and include paths in my path environment variable using Eclipse. Is there a full compatible compiler supporting all features of c++11 I can use with Eclipse?
    Last edited by Imanuel; 12-15-2012 at 11:04 AM.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Is there a full compatible compiler supporting all features of c++11 I can use with Eclipse?
    To my knowledge there is no compiler available for any platform that supports all features of C++11. However there might be a more recent version of g++ than the one you currently have. See this link: MinGW upgrade. And it also looks like the main minGW package has been upgraded to the 4.7 series so you may be able to get the package here also.

    Jim

  5. #5
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Is there a full compatible compiler supporting all features of c++11 I can use with Eclipse?
    I replied to this thread to laugh at you.

    GNU GCC has implemented the string conversions, according to this page (see the row starting with 21.5), but you would have to pull the code from the SVN and compile it. It's highly unlikely that it's in mingw right now but I could be wrong. If you *really need* these functions right now, try compiling with the bleeding edge in standards support.

    Code:
     mingw32-g++.exe -c test.cc -std=c++11 -o test
    If it doesn't work, you're stuck waiting for them to put it in later releases like the rest of us. But, as nice as these functions are, you shouldn't *really need* them.
    Last edited by whiteflags; 12-15-2012 at 09:30 PM.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Microsoft's Visual C++ compiler has the complete C++11 standard library, or so they claim.
    They do not support all core C++11 features, though.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Elysia View Post
    Microsoft's Visual C++ compiler has the complete C++11 standard library
    I'm pretty sure GCC does as well. the standard library is the easy part though.

  8. #8
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    The latest mingw uses gcc 4.7, which has better C++11 support than MSVC. But the library support relevant to this question should be available on any modern compiler.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  9. #9
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    The stoi() function will only be available starting with some of the latest versions of gcc. Version 4.5.2 did not support these functions, I don't remember if the 4.6 version supported them or not, but they are supported by the 4.7 versions.


    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-03-2008, 03:10 AM
  2. Library functions eg. String manipulation function
    By bhupesh.kec in forum C Programming
    Replies: 6
    Last Post: 07-08-2008, 07:32 AM
  3. Library Conversion (Static .lib -> function)
    By jmsold2 in forum C++ Programming
    Replies: 5
    Last Post: 10-05-2006, 06:07 PM
  4. still confused with string...
    By black in forum C++ Programming
    Replies: 13
    Last Post: 05-22-2002, 09:13 AM
  5. string object to null-terminating string conversion
    By sayz0 in forum C++ Programming
    Replies: 2
    Last Post: 11-05-2001, 12:15 PM