Author Topic: A Bug?  (Read 247 times)

Offline Landslyde

  • Multiple posting newcomer
  • *
  • Posts: 50
A Bug?
« on: June 25, 2019, 05:10:48 pm »
I did a tutorial on Vectors of Objects. The code runs fine. No problems. But I think I found a glitch in the Editor.
Code: [Select]
void printVector(const std::vector<Student>& newMyClass)
{
    unsigned int cSize = newMyClass.size();

    for (unsigned int i = 0; i < cSize; i++)
    {
        std::cout << "Student Name: " << newMyClass[i].getName() << "\n";
        std::cout << "Student Grade: " << newMyClass[i].getGrade() << "\n\n";
    }
}
Inside the FOR LOOP, I use the dot operator twice, each time after newMyClass. It should be bring up my Class information for me to select what I want to use, but it's dead. I had to type in getName() and getGrade(). The attached pic, from the tutorial, shows what I expected but didn't get. I'll attach the code too, just for kicks. Anyway, I can live with it the way it is. Just seems a little unbalanced.
Linux Mint 19.1
Code::Blocks 17.12
GCC 7.4.0

Offline sodev

  • Regular
  • ***
  • Posts: 295
Re: A Bug?
« Reply #1 on: June 25, 2019, 07:34:37 pm »
The handwritten code completion does not really work with c++11, even if your program isn't compiled in c++11, if your compiler ships headers which use c++11 constructs the parser has problems to understand them and hence the code completion stays dead.

Offline Landslyde

  • Multiple posting newcomer
  • *
  • Posts: 50
Re: A Bug?
« Reply #2 on: June 26, 2019, 01:15:24 am »
Thanks for the response.

Code Completion works great for me. Except it absolutely goes MIA at the points stated in my post. So I'm thinking something's amiss in the Code Completion to make it stall out like that and take a nosedive. I hope someone will verify this through the provided project code. Delete getName() and/or getGrade() in the printVector function and try to bring the Code Completion into play.
Linux Mint 19.1
Code::Blocks 17.12
GCC 7.4.0

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11824
    • Travis build status
Re: A Bug?
« Reply #3 on: June 26, 2019, 01:25:20 am »
I'm not 100% sure but I think our CC never supported operator overloading.
To properly report this we need minimal source code with zero includes.
The headers of stl might differ between different versions of your compiler and might expose different problems in CC.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Landslyde

  • Multiple posting newcomer
  • *
  • Posts: 50
Re: A Bug?
« Reply #4 on: June 26, 2019, 02:02:27 am »
Hi oBFusCATed:

I sent the whole shabang in my post. This was an exercise from 2012 that introduced creating an external class that uses vectors on the class objects. My post's provided zip file has everything in it. Throw away the stuff you don't need, but it's all right there. If you need more information, please let me know.
« Last Edit: June 26, 2019, 01:29:40 pm by Landslyde »
Linux Mint 19.1
Code::Blocks 17.12
GCC 7.4.0