STL vector<float> vecs, multidimensional

This is a discussion on STL vector<float> vecs, multidimensional within the C++ Programming forums, part of the General Programming Boards category; Hi there, I'm new to C/C++ and need some help. under www.cppreference.com in the STL there is a Template of ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    30

    STL vector<float> vecs, multidimensional

    Hi there,
    I'm new to C/C++ and need some help. under www.cppreference.com in the STL there is a Template of vector to make vectors. How can i make this Vector multidimensional?
    My target is a 2dimensional array, which contains a list of vectors.
    I have a file with 3 floats in a row, which needs to be written in a multidimensional array.
    Coords x y z
    in
    vecs[num][x]
    vecs[num][y]
    vecs[num][z]

    Thanks in advance!
    Jan

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    You mean you can't/aren't going to just create a struct that contains the three points and use that struct as the type for the vector object?
    Code:
    struct coord
    {
        float x;
        float y;
        float z;
    };
    
    vector<coord> CoordVector;
    Doesn't seem to me that you really need to make this a multidimensional vector. Are there design considerations/requirements here that are pushing you towards this decision?
    I used to be an adventurer like you... then I took an arrow to the knee.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Formatting Using STL
    By ChadJohnson in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2004, 04:52 PM
  2. im extreamly new help
    By rigo305 in forum C++ Programming
    Replies: 27
    Last Post: 04-23-2004, 11:22 PM
  3. STL or no STL
    By codec in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2004, 02:36 PM
  4. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM
  5. include question
    By Wanted420 in forum C++ Programming
    Replies: 8
    Last Post: 10-17-2003, 03:49 AM

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