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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:24:24+00:00 2026-06-17T07:24:24+00:00

I have a vector containing function pointers: vector<double (*)(vector<double>)> dY = {d2x,d2y,dx,dy} in another

  • 0

I have a vector containing function pointers:

vector<double (*)(vector<double>)> dY = {d2x,d2y,dx,dy}

in another function, I have a for loop iterating over this vector.

for( vector<double>::const_iterator it = dY.begin(); it != dY.end(); ++it){
    vector<double> Y = {0,10,0,10};
    ...
}

Now I want to compute d2x(Y),d2y(Y),dx(Y) and dy(Y), but I fail to correclty cast the iterator, so that I can supply the arguments.

How can I do this?

Thanks a lot

  • 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-17T07:24:25+00:00Added an answer on June 17, 2026 at 7:24 am

    Do you really iterate over the correct vector? The type of it in the loop doesn’t fit the dY vector.

    for( vector<double (*)(vector<double>)>::const_iterator it = dY.begin(); it != dY.end(); ++it)
    //          ^^^^^^^^^^^^^^^^^^^^^^^^^ -- You need the correct type here
    

    Once you have a correct iterator, this should work:

    double result = (*it)(Y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my simple game engine I have a vector containing pointers to entities. Each
I have a std::vector<double> In which GDB shows it containing these values: Wph <5
Having a vector containing pointers to objects then using the clear function doesn't call
Context When iterating over a set of Rdata files (each containing a character vector
I have a vector containing the values 0, 1, 2 and 3. What I
I have some data structures: all_unordered_m is a big vector containing all the strings
I have the vector d<-1:100 I want to sample k=3 times from this vector
I have the vector output = PV_out(:); I am trying to break this down
I have a vector containing large number of elements. Now I want to write
I have a 4 column array, I would like to obtain a vector containing

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.