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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:30:12+00:00 2026-05-18T21:30:12+00:00

I have a list of tasks. A task is defined by a name, a

  • 0

I have a list of tasks. A task is defined by a name, a due date (and time) and a duration.

My TaskManager class handles a std::list<Task> sorted by due date. It has to provide a way to get the tasks due on a specific day.

An example : I have task 1 due on Monday 6 am, task 2 due on Monday 9 am, task 3 due on Tuesday 7 pm. If I pass “Monday” to my method, it should return tasks 1 and 2.

How would you implement that ?

I think a good way (from API point of view) would be to provide a std::list<Task>::iterator pair. So I would have a TaskManager::begin(date) method. Do you think this method should get the iterator by iterating from the start of the list until it finds the first task due on that date, or by getting it from a std::map<date, std::list<Task>::iterator> (but then we have to keep it up-to-date when adding or removing tasks) ?

And then, how could I implement the TaskManager::end(date) method ?

  • 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-18T21:30:12+00:00Added an answer on May 18, 2026 at 9:30 pm

    instead of using a std::list, consider using a std::set or std::map, which can keep the items in a sorted order without additional effort. Then you can find the items due on a particular date using std::set::lower_bound or std::map::lower_bound.

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

Sidebar

Related Questions

I have a list of tasks (name, starts_at) and I'm trying to display them
I am trying to implement a sorted list. I have created the class I
I have a task list, and have defined each list item in list_item.xml as
I have a Task list in Sharepoint 2007 SP2. For this list I made
We have a SharePoint solution that uses a standard task list. We would like
I'm trying to do a simple task with jQuery: I have a list of
I have an app that is a list of tasks, like a to do
I have class Person as following : class Person { char* name; int age;
I have a list of tasks that are all draggable and droppable. All of
I have a list of stories defined and, in another table, a set of

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.