New to c++; Need help with common Libraries and Functions

This is a discussion on New to c++; Need help with common Libraries and Functions within the C++ Programming forums, part of the General Programming Boards category; Hi, I am new to C++ but have experience in other languages (PHP, Javascript, Java). What I am interested in ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    3

    New to c++; Need help with common Libraries and Functions

    Hi, I am new to C++ but have experience in other languages (PHP, Javascript, Java). What I am interested in doing is learning of the most commonly used functions in C++. I know that this sounds vague, and can be arbitrary to what your trying to accomplish, but I will try to give a good example. For instance, built-in or library functions that are used on arrays, pointers, functions, classes, and data types. Functions that will return information about those things (Length, Values, data type used, etc..). I know that C++ is a different beast than PHP or Java, so I am still getting down the ins and outs of the libraries that C++ offers. Any guidance on this subject is greatly appreciated.

    Thank You

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    The C++ standard library is your first stop. Consult your compiler's documentation, or get Nicolai Josutti's "The C++ Standard Library: A Tutorial and Reference". Note that it is far less extensive than PHP or Java's libraries.

    Then there are 3rd party libraries. Boost is a collection of very interesting libraries. Some other good C++ libraries are ACE (networking mostly, but a lot for multithreading too), Qt (GUI, and everything else too) and wxWidgets (like Qt).
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    138
    learning the libraries ahead of time is boring and really doesn't help unless you have perfect memory. wait until you have a specific need and then figure out what library does what you want.

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    You might probably want to start from a standard library reference (and some resources explaining the basics of C++).

    Functions that will return information about those things (Length, Values, data type used, etc..)
    I'm afraid C++ is statically typed, so that information is all already there in the code. Normally you can't get that info (in a way that you can use it for something useful) and don't need it.

    Only in template context you may sometimes need to get some type information. For that, containers for example have several typedefs, e.g

    Code:
    #include <vector>
    template <class Container>
    void foo(const Container& container)
    {
       //declare a variable that has the same type that the container holds
       typename Container::value_type var;
    }
    
    int main()
    {
        std::vector<int> vec;
        foo(vec); //var in foo will be int in this case
    }
    Also, iterators have means to find out what types they are for, e.g

    Code:
    #include <iterator>
    
    template <class Iterator>
    void foo(Iterator it)
    {
       //declare a variable that has the same type as the iterator iterates over
       typename std::iterator_traits<Iterator>::value_type var;
    }
    
    int main()
    {
        const char* p = "Hello world";
        foo(p); //var should be of type char
    }
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,915
    A newbie will not need type information, however. They're mostly useful when you do meta-template-programming. Quite an advanced subject.
    Although even C++ is statically typed, it's quite possible to get around and bend that system quite much, especially with templates.
    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.

  6. #6
    Registered User
    Join Date
    Feb 2009
    Posts
    3
    Thank you gals and guys for your advice on this subject.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static libraries and template functions
    By hauzer in forum C++ Programming
    Replies: 4
    Last Post: 10-26-2008, 07:28 AM
  2. Question about Downloading/Uploading Functions
    By TeCNoYoTTa in forum C++ Programming
    Replies: 0
    Last Post: 05-26-2008, 02:36 PM
  3. Libraries and functions
    By munever in forum C++ Programming
    Replies: 6
    Last Post: 06-20-2006, 04:17 PM
  4. Borland, libraries, and template member functions
    By roktsyntst in forum C++ Programming
    Replies: 0
    Last Post: 06-01-2003, 10:52 PM
  5. error LNK2001: unresolved external symbol
    By Unregistered in forum C Programming
    Replies: 12
    Last Post: 07-12-2002, 09:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21