What is a vector?

Hello, I was wondering, what is the operators <> used for in standard C++. I ask this because I wasn't aware that such an operator existed outside that visual C++, where it is used to declare an array. Futhermore, what is a vector? You see there's gaps in what I know of C++ due to simply migrated from C. Rather than studying the language as a whole.

Cheers

Comments

  • : Hello, I was wondering, what is the operators <> used for in standard C++. I ask this because I wasn't aware that such an operator existed outside that visual C++, where it is used to declare an array. Futhermore, what is a vector? You see there's gaps in what I know of C++ due to simply migrated from C. Rather than studying the language as a whole.
    :
    : Cheers
    :


    "Vector" is probably the most vauge term used in programming...
    In C++, vector is a standard container class for arrays. <> is not an operator but the syntax used for templates:

    vector x; // create a vector for integers.


  • : Hello, I was wondering, what is the operators <> used for in standard C++. I ask this because I wasn't aware that such an operator existed outside that visual C++, where it is used to declare an array. Futhermore, what is a vector? You see there's gaps in what I know of C++ due to simply migrated from C. Rather than studying the language as a whole.

    See www.codepedia.com/1/CppVector and www.codepedia.com/1/CppTemplate.
    See ya,
    bilderbikkel

  • : Hello, I was wondering, what is the operators <> used for in standard C++. I ask this because I wasn't aware that such an operator existed outside that visual C++, where it is used to declare an array. Futhermore, what is a vector? You see there's gaps in what I know of C++ due to simply migrated from C. Rather than studying the language as a whole.
    :
    : Cheers
    :
    [blue]Vector is an array of elements, like someone said here. However, the implementation of it is a linked list - nightmare, in other words. I stopped using vectors long ago - a simple growable array is better in my opinion. I agree, that implementation is compiler dependant, but all compilers, for some reason making a linked lists as vectors.[/blue]
  • : [blue]Vector is an array of elements, like someone said here. However, the implementation of it is a linked list - nightmare, in other words. I stopped using vectors long ago - a simple growable array is better in my opinion. I agree, that implementation is compiler dependant, but all compilers, for some reason making a linked lists as vectors.[/blue]

    Hi AsmGuru,

    the implementation of a std::vector is NOT of a linked list, a std::list is. A std::vector is guaranteed to have the same layout in memory as an array, for backwards compatibilty with C.

    See Scott Meyers article (http://www.artima.com/cppsource/top_cpp_books.html) to say that he regrets that this is not clearly reported in the Standard yet.

    See ya,

    bilderbikkel

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories