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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:58:01+00:00 2026-06-17T12:58:01+00:00

boost pdate is immutable, so how can I use it in a loop? I

  • 0

boost pdate is immutable, so how can I use it in a loop? I need to make comparison with last-dealt-with date:

    date last(neg_infin);
    for (int i = 0; i < tasks.size(); i++) {
            if (tasks[i]->getTime().date() > last) {
                cout << ":::" << tasks[i]->getTime().date() << ":::" << endl;
            }
            cout << "[" << i << "]" << '\t';
            tasks[i]->print();
            // i need to change the last date here
            cout << endl;
        }

ie. if the date part of current time is later than the previous, print the date, otherwise print only the time

  • 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-17T12:58:02+00:00Added an answer on June 17, 2026 at 12:58 pm

    Why do you need an explicit last element? Wont this work as well?

    if (i == 0 || tasks[i]->getTime().date() > tasks[i-1]->getTime.date()) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

c++/boost use all know that we can easily do reset a smart pointer to
boost::interprocess::scoped_lock<boost::interprocess::named_recursive_mutex> when creating an instance, i need to use the scoped_lock(mutex_type & m, const
I have a boost::posix_time::ptime that points to March 31st 2010 like this: ptime p(date(2010,
boost::timed_lock void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } boost::timed_mutex mutex; void thread() { for (int
Boost property tree seems like an excellent library to use for parsing config files.
typedef boost::variant<int, double> Type; class Append: public boost::static_visitor<> { public: void operator()(int) {} void
Is the following valid? class myClass { private: ... int m_nDataLength; boost::shared_array<int> m_pData; ...
boost::recursive_mutex and boost::lock_guard seem to use boost_thread-bcb-mt-1_39.dll in C++ Builder 2010. I see that
boost::recursive_mutex m; m.lock(); versus boost::lock_guard<boost::recursive_mutex> lock( mutex_ ); Is there an advantage to use
The Boost documentation does not specify this. When I use boost::python::import , where exactly

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.