Code::Blocks Forums

User forums => Help => Topic started by: Landslyde on June 25, 2019, 05:10:48 pm

Title: A Bug?
Post by: Landslyde 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.
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.
Title: Re: A Bug?
Post by: sodev 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.
Title: Re: A Bug?
Post by: Landslyde 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.
Title: Re: A Bug?
Post by: oBFusCATed 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.
Title: Re: A Bug?
Post by: Landslyde 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.