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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:20:37+00:00 2026-05-24T20:20:37+00:00

I am having problems building a library in VC9, but which was previously successfully

  • 0

I am having problems building a library in VC9, but which was previously successfully built in VC6.
Here is a part of the code:

size_t pos2find;
pos2find = J; 
std::vector<size_t>::iterator it(&pos2find);

And here is the error:

    error C2664: 'std::_Vector_iterator<_Ty,_Alloc>::_Vector_iterator(const std::_Vector_iterator<_Ty,_Alloc> &)' : cannot convert parameter 1 from 'size_t *' to 'const std::_Vector_iterator<_Ty,_Alloc> &'
    1>        with
    1>        [
    1>            _Ty=size_t,
    1>            _Alloc=std::allocator<size_t>
    1>        ]
    1>        Reason: cannot convert from 'size_t *' to 'const std::_Vector_iterator<_Ty,_Alloc>'

1>        with
1>        [
1>            _Ty=size_t,
1>            _Alloc=std::allocator<size_t>
1>        ]
1>        No constructor could take the source type, or constructor overload resolution was ambiguous

I appreciate any help.

EDIT:
The code is from an open source library called “surfit”, it is not my code, so i guess it’s something that changed in the standard of the vector class.
The iterator is then used in another std function:

std::vector<size_t>::iterator * ptr_from = fault->sort_by_first_begin;
std::vector<size_t>::iterator * ptr;
ptr = std::lower_bound(ptr_from, 
               fault->sort_by_first_end, 
               it, 
               ptr_size_t_less);

EDIT:
I think i found a solution. After looking into std::lower_bound() :

template <class ForwardIterator, class T, class Compare>
  ForwardIterator lower_bound ( ForwardIterator first, ForwardIterator last,
                                const T& value, Compare comp );

Return iterator to lower bound
Returns an iterator pointing to the first element in the sorted range [first,last) which does not compare less than value. The comparison is done using either operator< for the first version, or comp for the second.

For the function to yield the expected result, the elements in the range shall already be ordered according to the same criterion (operator< or comp).

With this i just eliminated the it iterator and used lower_bound(first, last, &pos2find, comp);

  • 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-24T20:20:37+00:00Added an answer on May 24, 2026 at 8:20 pm

    An iterator into a vector isn’t guarantied to be a raw pointer. In VS6 vector<T>::iterator happened to be a T* so you could initialize the iterator with a T*.
    In later versions of VS the implementation of vector<T>::iterator changed to be a class type (as it’s entitled to be) so code that made bad assumptions now fails to compile.

    In any case the code you posted is buggy even if iterator is a T* since the pointer supplied is not a pointer into the vector.

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

Sidebar

Related Questions

Im having problems building a query with the linq to sql data query expression
Im having problems with classpaths. I have used them before with import but I'm
I am having some problems building a properly formatted SOAP message using XMLDocument in
I was having some other problems with some ports building for the wrong CPU
I'm trying to open and process ASCII files using PHP, but am having problems.
I am building an application on Mac in Qt. I am having problems in
I am programmatically building a UINavigationContoller for iOS and am having problems making it
I'm building the Android scanning app using zxing library. I have built the zxing
I'm having problems building my app on 1st generation iPod touch. I've changed the
I have an old C++ project and I'm having problem building it. For a

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.