CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    8

    matrix class? STL ?

    Does anyone know what header file needs to be included to use the matrix class?
    ex:
    Im trying to use
    matrix<int> x(2,3)

    is this an STL class? is this included in VC++ 6 ?

    its suppose to create a 2D int-array with 2 Rows and 3 Columns

    I also have another question regarding the #include in VC++..

    I noticed my usage of #include<vector> requires me to use the namespace std, why ?

    what is the difference between #include<vector.h> and #include<vector>

    ouch thats a lot of questions.
    Hopefully there is a Jedi brave enough for this challenge

    Thanks guys.

  2. #2
    Join Date
    Jul 2001
    Location
    Netherlands
    Posts
    751
    just use a vector of vectors.
    typedef std::vector<YourObject> YourObjectVector;
    typedef std::vector<YourObjectVector> YourMatrix;
    That's probably what that matrix thing is doing anyway. Also this is not a visual issue so the other board is better for that.

  3. #3
    Join Date
    Feb 2002
    Location
    Krispl, Austria
    Posts
    197
    I don't know this matrix class and I don't think it's part of the STL (I may be wrong). Do you want matrix functions as inverse, determinant, multiplication etc. There are many matrix classes around, even I have written one (non MFC).

  4. #4
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: matrix class? STL ?

    Originally posted by LudaLuda I noticed my usage of #include<vector> requires me to use the namespace std, why ?

    what is the difference between #include<vector.h> and #include<vector>
    In C++, the Standard Template Library (STL) is all in the namespace std so that it doesn't conflict with other definitions. <vector> is the standard include file for STL's vector container. <vector.h> is a deprecated (old) include file that some compilers provide for compatibility with programs written before the C++ standard came out. Never use this in new programs you write.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  5. #5
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: matrix class? STL ?

    Originally posted by LudaLuda
    Does anyone know what header file needs to be included to use the matrix class?
    Since 'matrix' is not a standard class of the STL...it depends on where you got this class...

    Originally posted by LudaLuda
    is this an STL class? is this included in VC++ 6 ?
    No...

    Originally posted by LudaLuda
    its suppose to create a 2D int-array with 2 Rows and 3 Columns
    You can use a 'vector' as well as shown in the following FAQ...

    Originally posted by LudaLuda
    I noticed my usage of #include<vector> requires me to use the namespace std, why ?

    what is the difference between #include<vector.h> and #include<vector>
    According to ISO C++ standard, the definition all the classes, objects and functions of the standard C++ library are defined within namespace 'std'.

    Almost all compilers, even those complying with ISO standard, allow the use of the traditional header files (like iostream.h, stdlib.h, etc). Nevertheless, the ISO standard has completely redesigned these libraries taking advantage of the template feature and following the rule to declare all the functions and variables under the namespace 'std'.

    The standard has specified new names for these "header" files, basically using the same name for C++ specific files, but without the ending '.h'. For example, 'iostream.h' becomes 'iostream'.

    If you use the ISO C++ compliant include files you have to bear in mind that all the functions, classes and objects will be declared under the 'std' namespace.

  6. #6
    Join Date
    May 2002
    Posts
    1,798
    LudaLuda,

    Try this STL matrix class.

    Free STL Matrix Class

    Let me know if you find it helpful.

    Mike
    Last edited by Mike Pliam; January 20th, 2010 at 02:13 AM.
    mpliam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured