Results 1 to 3 of 3

Thread: STL Container Size Limit Report

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    STL Container Size Limit Report

    I wrote this little test program to find the size limits of some of the Standard Template Library Containers. I would like to see what differences, if any, and which situations machine to machine, OS to OS or both.
    It is a console app. You might need to scroll up to see the whole output. It will give your results first and then print my results for reference.

    The code listing is just for reference. The attachment has the executable console app.

    #include <iostream>
    #include <stdlib.h>
    #include <vector>
    #include <list>
    #include <map>
    
    using namespace std;
    
    int kvs = 1073741823;
    int kvi = 1073741823;
    int kls = 357913941;
    int kli = 357913941;
    int km  = 178956970;
    
    int main()
    {
        vector<string>  vs;
        vector<int>     vi;
    
        list<string>    ls;
        list<int>       li;
    
        map<int,string> m;
    
        cout << endl << "              Container Limits" << endl << endl ;
    
        cout << "           Your Results: "<< endl  << endl;
        cout << "      Vector of strings: "<< vs.max_size() << endl;
        cout << "     Vector of integers: "<< vi.max_size() << endl  << endl;
    
        cout << "        List of strings: "<< ls.max_size() << endl;
        cout << "       List of integers: "<< li.max_size() << endl  << endl;
    
        cout << "Map of ints and strings: "<< m.max_size()  << endl  << endl;
        cout << "==================================================" << endl;
        cout << "         Kent's Results: "<< endl << endl;
        cout << "      Vector of strings: "<< kvs  << endl;
        cout << "     Vector of integers: "<< kvi  << endl  << endl;
    
        cout << "        List of strings: "<< kls  << endl;
        cout << "       List of integers: "<< kli  << endl  << endl;
    
        cout << "Map of ints and strings: "<< km  << endl   << endl;
        system("pause");
        return 0;
    }
    
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by kryton9; 24-12-2011 at 01:37.

  2. #2
    Kent,


    I am a novice c++ programmer so I use the latest Bcx. No {}; needed


    Using MinGWTDM compiler on Win7 64.
    Compiled as 32bit and 64bit app
    32bit matches yours. Not sure on the 64bit results


    James
    $CPP
    $NOMAIN
    '32bit
    $ONEXIT "GCTD.BAT $FILE$ -m32"
    '64bit
    '$ONEXIT "GCTD.BAT $FILE$ -m64"
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    #include<vector>
    #include<list>
    #include<map>
    Dim Raw As int kvs = 1073741823,kvi = 1073741823,kls = 357913941,kli = 357913941,km  = 178956970
    Function main() As Integer
        
        vector<string>  vs
        vector<int>     vi
     
        list<string>    ls
        list<int>       li
     
        map<int,string> m
     
        cout << endl << "              Container Limits" << endl << endl 
     
        cout << "           Your Results: "<< endl  << endl
        cout << "      Vector of strings: "<< vs.max_size() << endl
        cout << "     Vector of integers: "<< vi.max_size() << endl  << endl
     
        cout << "        List of strings: "<< ls.max_size() << endl
        cout << "       List of integers: "<< li.max_size() << endl  << endl
     
        cout << "Map of ints and strings: "<< m.max_size()  << endl  << endl
        cout << "==================================================" << endl
        cout << "         Kent's Results: "<< endl << endl
        cout << "      Vector of strings: "<< kvs  << endl
        cout << "     Vector of integers: "<< kvi  << endl  << endl
     
        cout << "        List of strings: "<< kls  << endl
        cout << "       List of integers: "<< kli  << endl  << endl
     
        cout << "Map of ints and strings: "<< km  << endl   << endl    
    
    
        system("pause")
    End Function
    
    Attached Images Attached Images

  3. #3
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405
    Thanks James. I am sorry I forgot to mention the attachment had an executable. I just listed the code, for reference, as to what was in the executable.
    You pointed out a major flaw in my test, not testing for 32 bit and 64 bit. Thanks for both listings. At least I know now that it can change.
    Last edited by kryton9; 24-12-2011 at 01:35.

Similar Threads

  1. The limit as t --> 0, of, sin(t)/t
    By danbaron in forum Math: all about
    Replies: 1
    Last Post: 28-07-2011, 01:05
  2. The Limit of Randomize()
    By danbaron in forum General purpose scripts
    Replies: 0
    Last Post: 18-02-2010, 09:34
  3. TBDI - Progress report
    By Michael Hartlef in forum TBDI module. thinBasic Direct Input integration by MikeHart
    Replies: 30
    Last Post: 14-03-2007, 10:04
  4. Textbox Limit?
    By catventure in forum thinBasic General
    Replies: 8
    Last Post: 18-11-2006, 19:15

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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