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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:44:04+00:00 2026-06-02T23:44:04+00:00

Here is some working code: std::pair<typename std::map< time_t, T >::iterator, bool> ret; ret =

  • 0

Here is some working code:

std::pair<typename std::map< time_t, T >::iterator, bool> ret;    
ret = prt_map->insert ( std::pair< time_t, T >( seconds , value ) );
if (ret.second == false) // exists
{
 ... update exising value
}

I want to upgrade it to max efficient inserting code and give a tip to insert that need to start from –prt_map->end(); something like:

  prt_map->insert ( --prt_map->end(), std::pair< time_t, T >( seconds , value ) );

but this insert function prototupe does not return std::pair with bool that notify that value added or not ( to check for existing and update if so… How to solve this to have ability to update existing value?

  • 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-02T23:44:07+00:00Added an answer on June 2, 2026 at 11:44 pm

    The post condition of a.insert(hint, t) is:

    a contains an element whose key is the same as that of t. The size of a is incremented by either 1 or 0.

    which should be sufficient information to determine whether or not the element was inserted.

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

Sidebar

Related Questions

Here is some example code: #include <iostream> #include <vector> template <typename T> std::vector<typename T::iterator>
here is some code I've been working on, basically I need to set up
I'm working off some code for a drop-down menu I found here on stack
I finally got some parts working here: http://jsfiddle.net/trXBr/5/ but when I put the code
I'm experiencing a problem in some code I've been working on. Here is the
I'm working with some code I borrowed from here which uses boost::call_once to make
Well i am here writing some constraints for a db I am working on
I need some opinions here. I'm working on a Django project using buildout to
I'm working on a stored proc that executes some dynamic sql. Here's the example
The script I am working with is here: https://gist.github.com/2759751 I want to modify some

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.