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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:56:33+00:00 2026-05-14T03:56:33+00:00

In C++, I’m looking to implement an operator for selecting items in a list

  • 0

In C++, I’m looking to implement an operator for selecting items in a list (of type B) based upon B being contained entirely within A.

In the book “the logical design of digital computers” by Montgomery Phister jr (published 1958), p54, it says:

F11 = A + ~B has two interesting and useful associations, neither of them having much to do with computer design. The first is the logical notation of implication… The second is notation of inclusion… This may be expressed by a familiar looking relation, B < A; or by the statement “B is included in A”; or by the boolean equation F11= A + ~B = 1.

My initial implementation was in C. Callbacks were given to the list to use for such operations. An example being a list of ints, and a struct containting two ints, min and max, for selection purposes.

There, selection would be based upon B >= A->min && B <= A->max.

Using C++ and templates, how would you approach this after having implemented a generic list in C using void pointers and callbacks?

Is using < as an over-ridden operator for such purposes… <ugh> evil? </ugh>

(or by using a class B for the selection criteria, implementing the comparison by overloading > ?)

edit: my implementation of the nodes for the list contains a member for flagging item selection or not.

with regards to sets, and uniqueness, the data in the list will likely contain a member specifying position along a time line, given that is one of the main selection criteria, using the term set might be misleading as there is no guaranteed uniqueness regarding position along the time line – that is events can occur simultaneously.

  • 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-14T03:56:33+00:00Added an answer on May 14, 2026 at 3:56 am

    The way this is done all over the place in the standard library is two have a templated parameter that can take a function/functor and that is used for the comparisons:

    template<typename Predicate>
    void container::select(Predicate p) {
       if (p(items[0])) {
         // something
       }
    }
    

    Some examples from the standard library would remove_if or lower_bound.

    (Also be aware that there already is a set class template in the standard library, and algorithms like set_intersection)

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

Sidebar

Ask A Question

Stats

  • Questions 453k
  • Answers 453k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Assuming you read the image into from disk you would… May 15, 2026 at 9:32 pm
  • Editorial Team
    Editorial Team added an answer Take a look on Configure class. You can Configure::write('var', $value)… May 15, 2026 at 9:32 pm
  • Editorial Team
    Editorial Team added an answer You're describing a many-to-many relationship. You will need an intermediate… May 15, 2026 at 9:32 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.