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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:53:20+00:00 2026-05-26T15:53:20+00:00

The complete code is on https://gist.github.com/1341623 I’d like to sort an index array (or

  • 0

The complete code is on https://gist.github.com/1341623

I’d like to sort an index array (or vector) for another vector, such that the array is ordered by the index of the other vector. However, the type of vector::at cannot be resolved.

I did a try as follows:

This is OK

sort(v.begin(), v.end());

I’d like to sort the indexes according to the array, but placeholders do not overload operator[]

sort(index,index+10, a[_1] < a[_2]);

However, they overload operator+ and operator*

sort(index,index+10, *(a+_1) < *(a+_2));

I’d like to sort the indexes according to the vector, but compiler cannot resolve the type of `vector::at’.

sort(index,index+10,
  bind(&(vector<int>::at), &v, _1) < bind(&(vector<int>::at), &v, _2));
// error: no matching function for call
// to ‘bind(<unresolved overloaded function type>, ...

After searching on the web, I found I have to specify the overloaded method type, but compiler still says it cannot resolve the type.

sort(index,index+10,
   bind(&static_cast<const int (*)(size_t)>(vector<int>::at), &v, _1)
 < bind(&static_cast<const int (*)(size_t)>(vector<int>::at), &v, _2));
// error: invalid static_cast from type ‘<unresolved overloaded function type>’
// to type ‘const int (*)(size_t)’ ...

I tried to get the version of vector::at I want, but the conversion seems to be failed.

vector<int>::const_reference (*vector_int_at)(vector<int>::size_type)(vector<int>::at);
sort(index,index+10,
  bind(&vector_int_at, &v, _1) < bind(&vector_int_at, &v, _2));
// error: no matches converting function ‘at’ to type ‘const int& (*)(size_t)’ ...

What can I do for this problem? Or I misunderstand something?

  • 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-26T15:53:20+00:00Added an answer on May 26, 2026 at 3:53 pm

    Remember that pointers to member functions and pointers to free functions have different types. Try:
    vector<int>::const_reference (vector<int>::*vector_int_at)(vector<int>::size_type) const = &vector<int>::at;

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

Sidebar

Related Questions

I'm using puppybits jQuery plugin QTransform to rotate/animate an element ( https://github.com/puppybits/QTransform ). I
I am using the following code to accept payments for digital goods: https://www.x.com/blogs/Nate/2011/01/07/digital-goods-with-express-checkout-in-php I
So I downloaded a wrapper class from this github link: https://github.com/ignaciovazquez/Highrise-PHP-Api and I'm just
Below is the complete code of the jquery AJAX tab script I am working
I am using the following code --- EDIT @annakata : Adding the complete code
In most of the videos, I see expert JQuery developers writing complete code for
I am trying to do this: List<Parent> test = new List<Child>(); The complete code
The code-complete feature in Visual Studio is very useful, and it still works for
In the book 'Code Complete' the author talks about programming into a language (instead
I'm just reading Code Complete by Steve McConell and I'm thinking of an Example

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.