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 8666455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:44:11+00:00 2026-06-12T17:44:11+00:00

I was wondering if one could implement custom iterators to an abstract class as

  • 0

I was wondering if one could implement custom iterators to an abstract class as an embedded class with appropriate overloading of operators and methods. That is, if it would be alright as a starting point to start as:

template <typename T>
class my_class {
public:
    .
    .
    class iterator {
    public:
        .
        .
    };
};

I have tried understanding several different ways of implementing custom iterators, but it would be easier to grasp if layout can be a bit simplified. The methods like begin(), end(), etc., can be now implemented in my_class along with any other types required.

Would such an implementation be compatible with STL algorithms? I remember having implemented such an iterator class that seemed to work, but I am not sure if it would be ok in general.

  • 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-06-12T17:44:12+00:00Added an answer on June 12, 2026 at 5:44 pm

    There is no requirement where the type should be defined. It has to be accessible as container::iterator (and container::const_iterator) and there is no reason why it couldn’t be defined right there. A nested type is a type just like any other.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`ve been wondering how to implement methods in a class. Could someone explain me
I'm new to using iterators and was wondering how one would iterate through each
I'm wondering how one would implement an outline view like the one Xcode 3
I have a iterator like this one: http://nz.php.net/manual/en/class.iterator.php And I was wondering how could
I'm wondering about how you would implement an effect similar to this one implemented
I was wondering if any one could help me out; I have a table
I was wondering how could I remove one (wrongly inserted) entry/word from the ispell
I was wondering how one would go about developing a website from scratch with
In Business Intelligence Developer Studio, I'm wondering why one would want to create a
I have just started learning Scala and I'm now wondering how I could implement

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.