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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:00:51+00:00 2026-06-18T06:00:51+00:00

My question is simple enough, given the following data structure, std::vector<std::pair<int, std::unique_ptr<foo>>> , if

  • 0

My question is simple enough, given the following data structure, std::vector<std::pair<int, std::unique_ptr<foo>>>, if I have the following:

auto it = std::find_if(begin(v), end(v), [&](std::pair<...> const& p){ return p.first == some_value; });

Can I expect that whatever is pointed to by the pointer is not fetched (I don’t want it fetched, will later pre-fetch as needed) into the cache purely for the find operation? Or is this impossible to determine (if so I will close the question..)

  • 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-18T06:00:52+00:00Added an answer on June 18, 2026 at 6:00 am

    When “find” searches in a vector, it will look at the value of the entry in the vector, and match that with what you are searching for. So, it will use whatever “equal” function that is provided by the find, or “operator==” if there is no function provided to find.

    Since in this case, you are just comparing the int value in the pair with your expected value, the unique_ptr<foo> will not be dereferenced (and thus data pointed to by unique_ptr<foo> will not enter the cache).

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

Sidebar

Related Questions

Simple enough question I hope. I am using the following type of code to
Given the following: struct Foo { int bar() const; }; struct IsEqual : public
Given the following: struct Foo { int bar() const; }; struct IsEqual : public
Simple enough question. What is the 'aspx' or 'ascx' page called? I need the
Simple enough question: I'm using python random module to generate random integers. I want
Simple enough question I am sure. Using MFC C++, what header do I need
this seems like a simple enough question but I can't seem to find a
I'm sure this question has a simple enough answer, but I can't seem to
Really simple question here but bugging me for long enough to ask. Code looks
Question simple and quick: I have started to use Netbeans to write some code

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.