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

  • Home
  • SEARCH
  • 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 6225679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:53:11+00:00 2026-05-24T08:53:11+00:00

In Effective STL tip 16, it says that we should avoid to pass iterator

  • 0

In “Effective STL” tip 16, it says that we should avoid to pass iterator to a function which accepts a pointer. Could anyone explain the detail for me please?

void doSomething(const int* pInts, size_t numInts);
vector<int> v;
...
doSomething(&v[0],v.size()) //correct
doSomething(v.begin(),v.size()) //incorrect
  • 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-24T08:53:11+00:00Added an answer on May 24, 2026 at 8:53 am

    In some early implementations of the standard library iterators were implemented as pointers.

    Code that depended on that property stopped working when iterators became non-pointers.

    So, you should not pass an iterator where a pointer is expected, because if it compiles then it’s just by happen-chance. An iterator is not necessarily a pointer. And if it is a pointer, then it may not necessarily be a pointer in some later version (of the library, compiler, whatever).

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

Sidebar

Related Questions

I noticed in Effective STL that vector is the type of sequence that should
The Effective Java says that readResolve works only if all fields are transient .
Effective Java , along with other sources suggest that we should consider using composition
Working my way through Effective STL at the moment. Item 5 suggests that it's
When I read Effective C++, it says, never redefine a non-virtual function in C++.
What is the most effective way to create a PHP function that will pick
In Effective C++ (3rd edition), Scott Meyers, in Item 31, suggests that classes should
Which method is very effective and simple to code to attain this functionality ?
Effective java says: // Potential security hole! static public final Thing[] VALUES = {
Effective Java says: A third common source of memory leaks is listeners and other

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.