Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. wince vector problem, i need help
Forum Updated to NodeBB v4.3 + New Features

wince vector problem, i need help

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
10 Posts 4 Posters 759 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CraigTaoC Offline
    CraigTaoC Offline
    CraigTao
    wrote on last edited by
    #1
    std::vector<int> test1;
    test1.resize(15);
    int sz = test1.size();
    for (int i = 0; i < sz; i++)
    {
    	test1[i] = i;
    }
    
    for (int i = 0; i < sz; i++)
    {
    	int val = test1[i];
    }
    
    std::vector<int> test2;
    test2.resize(20);
    sz = test2.size();
    for (int i = 0; i < sz; i++)
    {
    	test1[i] = i;
    }
    
    for (int i = 0; i < sz; i++)
    {
    	int val = test1[i];
    }
    

    error: index out of range
    IDE: vs2008
    QT: qt4.7.3 for everywhere
    i do it like this article :
    https://forum.qt.io/topic/19049/qt-under-windows-ce-is-very-slow

    ![2_1560420878458_3.jpg](Uploading 100%) ![1_1560420878457_2.jpg](Uploading 100%) ![0_1560420878457_1.jpg](Uploading 100%)

    KroMignonK 1 Reply Last reply
    0
    • CraigTaoC Offline
      CraigTaoC Offline
      CraigTao
      wrote on last edited by
      #2

      0_1560420993228_1.jpg

      1 Reply Last reply
      0
      • CraigTaoC CraigTao
        std::vector<int> test1;
        test1.resize(15);
        int sz = test1.size();
        for (int i = 0; i < sz; i++)
        {
        	test1[i] = i;
        }
        
        for (int i = 0; i < sz; i++)
        {
        	int val = test1[i];
        }
        
        std::vector<int> test2;
        test2.resize(20);
        sz = test2.size();
        for (int i = 0; i < sz; i++)
        {
        	test1[i] = i;
        }
        
        for (int i = 0; i < sz; i++)
        {
        	int val = test1[i];
        }
        

        error: index out of range
        IDE: vs2008
        QT: qt4.7.3 for everywhere
        i do it like this article :
        https://forum.qt.io/topic/19049/qt-under-windows-ce-is-very-slow

        ![2_1560420878458_3.jpg](Uploading 100%) ![1_1560420878457_2.jpg](Uploading 100%) ![0_1560420878457_1.jpg](Uploading 100%)

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by
        #3

        @CraigTao said in wince vector problem, i need help:

        std::vector<int> test2;
        test2.resize(20);
        sz = test2.size();
        for (int i = 0; i < sz; i++)
        {
        test1[i] = i;
        }

        for (int i = 0; i < sz; i++)
        {
        int val = test1[i];
        }

        sz = test2.size() ==> and in loop you are using test1.

        test1 has only 15 elements!

        change your loop to:

         for (int i = 0; i < test1.size(); i++)
         {
         	test1[i] = i;
         }
        

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        1 Reply Last reply
        0
        • CraigTaoC Offline
          CraigTaoC Offline
          CraigTao
          wrote on last edited by
          #4

          0_1560422074302_1.jpg

          i do it don't like this article :
          https://forum.qt.io/topic/19049/qt-under-windows-ce-is-very-slow

          still error, vector index out of range

          i used qt4.8 wince, still this error,

          1 Reply Last reply
          0
          • CraigTaoC Offline
            CraigTaoC Offline
            CraigTao
            wrote on last edited by
            #5

            std::vector<int> test2;
            test2.resize(20);
            sz = test2.size();
            for (int i = 0; i < sz; i++)
            {
            test2[i] = i;
            }

            for (int i = 0; i < sz; i++)
            {
            int val = test2[i];
            }

            sorry , i write wrong, but still error

            KroMignonK jsulmJ 2 Replies Last reply
            0
            • CraigTaoC CraigTao

              std::vector<int> test2;
              test2.resize(20);
              sz = test2.size();
              for (int i = 0; i < sz; i++)
              {
              test2[i] = i;
              }

              for (int i = 0; i < sz; i++)
              {
              int val = test2[i];
              }

              sorry , i write wrong, but still error

              KroMignonK Offline
              KroMignonK Offline
              KroMignon
              wrote on last edited by
              #6

              @CraigTao just to clarify std::vector has nothing to do with Qt, it is from the C++ compiler standard library: std::vector

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              M CraigTaoC 2 Replies Last reply
              0
              • CraigTaoC CraigTao

                std::vector<int> test2;
                test2.resize(20);
                sz = test2.size();
                for (int i = 0; i < sz; i++)
                {
                test2[i] = i;
                }

                for (int i = 0; i < sz; i++)
                {
                int val = test2[i];
                }

                sorry , i write wrong, but still error

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @CraigTao In which line exactly does that happen? And did you try to debug step by step to see what happens and what values all your variables have?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • KroMignonK KroMignon

                  @CraigTao just to clarify std::vector has nothing to do with Qt, it is from the C++ compiler standard library: std::vector

                  M Offline
                  M Offline
                  mvuori
                  wrote on last edited by
                  #8

                  Neither has it anything particular to do with mobile and embedded systems

                  1 Reply Last reply
                  0
                  • KroMignonK KroMignon

                    @CraigTao just to clarify std::vector has nothing to do with Qt, it is from the C++ compiler standard library: std::vector

                    CraigTaoC Offline
                    CraigTaoC Offline
                    CraigTao
                    wrote on last edited by
                    #9

                    @KroMignon I Use QVector instead of std::vector , this error still here,

                    jsulmJ 1 Reply Last reply
                    0
                    • CraigTaoC CraigTao

                      @KroMignon I Use QVector instead of std::vector , this error still here,

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @CraigTao Then please use debugger to debug and see what happens.
                      You did not even tell us in which line exactly this happens...

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved