Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 518561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:56:58+00:00 2026-05-13T07:56:58+00:00

I have a vector<list<customClass> > I have an iterator vector<list<customClass> >::const_iterator x When I

  • 0

I have a vector<list<customClass> >

I have an iterator vector<list<customClass> >::const_iterator x

When I try to access an member of customClass like so:

x[0]->somefunc(), I get errors of a non-pointer type/not found.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:56:59+00:00Added an answer on May 13, 2026 at 7:56 am

    Here’s a complete working snippet. To answer your question, the line with the comment [1] shows how to dereference the const_iterator, while comment [2] shows how to dereference using the operator [].

    #include <vector>
    #include <list>
    #include <iostream>
    class Foo
    {
    public:
        void hello() const
        {
            std::cout << "hello - type any key to continue\n";
            getchar();
        }
    
        void func( std::vector<std::list<Foo> > const& vec )
        {
            std::vector<std::list<Foo> >::const_iterator qVec = vec.begin();
            qVec->front().hello(); // [1] dereference const_iterator
        }
    };
    int main(int argc, char* argv[])
    {
        std::list<Foo>  list;
        Foo foo;
        list.push_front(foo);
        std::vector<std::list<Foo> > vec;
        vec.push_back(list);
    
        foo.func( vec );
        vec[0].front().hello(); // [2] dereference vector using []
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a vector of Linked list pointers. Each LinkedList has a head pointer
I'm trying to get a simple delete every pointer in my vector/list/... function written
I have a vector like this std::vector<Sprite*> mDrawings; std::vector<Sprite*>::iterator it = mDrawings.begin(); This gives
Say you have a simple class with some storage data structure (list, vector, queue,
I have a ptr_vector list of my own objects. Something like this: boost::ptr_vector<SomeClass> *list;
Would it be smart to have a vector in an object with a list
Say I have a list and a vector, and I want to zip them
I have a vector of strings: std::vector<std::string> fName which holds a list of file
Is it legal to have a vector of references to objects, like the following?
I have vector with 6 numbers, which I want insert to list and add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.