473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

predicates,

Why derive from: binary_function? It seems like that class just does some
typedefs.

For example, in Stroustrup (pg. 517 3rd edition):

class Club_eq : public unary_function<Club, bool{
string s;
public:
explicit Club_eq(const string& ss) : s(ss) {}
bool operator()(const Club& c) const { return c.name == s; }
};

He still uses "Club" and "bool" instead of the typdefed argument_type and
result_type. So what is the point of these base classes?
Jul 2 '06 #1
4 1518
vsgdp wrote:
Why derive from: binary_function? It seems like that class just does
some typedefs.
You've answered your own question, I believe.
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 2 '06 #2

"Victor Bazarov" <v.********@comAcast.netwrote in message
news:Kd******************************@comcast.com. ..
vsgdp wrote:
>Why derive from: binary_function? It seems like that class just does
some typedefs.

You've answered your own question, I believe.
No, what is the point of the typedefs?
Jul 2 '06 #3
TB
vsgdp skrev:
"Victor Bazarov" <v.********@comAcast.netwrote in message
news:Kd******************************@comcast.com. ..
>vsgdp wrote:
>>Why derive from: binary_function? It seems like that class just does
some typedefs.
You've answered your own question, I believe.

No, what is the point of the typedefs?

For example, the typedefs are used to propagate type data
within template expansions.

--
TB @ SWEDEN
Jul 2 '06 #4
In article <GKUpg.170$5K2.84@fed1read03>, he***@null.com says...
Why derive from: binary_function? It seems like that class just does some
typedefs.

For example, in Stroustrup (pg. 517 3rd edition):

class Club_eq : public unary_function<Club, bool{
string s;
public:
explicit Club_eq(const string& ss) : s(ss) {}
bool operator()(const Club& c) const { return c.name == s; }
};

He still uses "Club" and "bool" instead of the typdefed argument_type and
result_type. So what is the point of these base classes?
The typedefs aren't (at least primarily) for the benefit of the code
in the predicate itself. Rather, they're for use by the code in the
algorithm(s) to which you pass the predicate as an argument. The
typedefs give that code information about your predicate so the
predicate can be used correctly.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jul 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thong Nguyen | last post by:
I wrote my own Predicate class for .NET 1.1 which allowed composite predicates using operator overloading... for example: Predicate p1 = {...}; Predicate p2 = {...}; Predicate p1andp2 =...
0
by: dayzman | last post by:
Hi, M'm writing a program to output the results of transforming logical predicates using deMorgan's. Does anyone know of a library that handles logical predicates? Cheers, Michael
2
by: Praveen | last post by:
Hi, Hi I am a newbie in DB2 and Mainframe.I would like to know if there is any diffence between the Quantified Predicates: IN , ANY, and SOME. Thank you very much for your valuable time. ...
1
by: Trent Buck | last post by:
I'm trying to find CPP predicates that allow conditional compilation based on the compiler's standard / features / extensions. So far I have determined that, for GCC, - __STRICT_ANSI__ implies...
2
by: Markus Neifer | last post by:
Hi, i've read that 'Col BETWEEN expr1 and expr2' became stage 1 and indexable in DB2 UDB for z/OS Version 8. Is there any way to find out which predicates are stage 1 and indexable in V7/V8? ...
1
by: David Veeneman | last post by:
I've been looking at predicate delegates in connection with List<Tsearch methods. My initial reaction is that the mechanism looks cumbersome, to the point where I'm wondering if it's not just...
5
by: Altu | last post by:
Hi all, What does something like mean in an XPath query like /c/d ? If I am not wrong, /c/d means return all d elements that their parent is c and their grand parent is the root element and...
7
balabaster
by: balabaster | last post by:
Okay, after having bashed my head against this long enough I thought of you guys... I thought having exhausted just about every other .NET concept I would come back to predicates because Microsoft's...
0
by: raylopez99 | last post by:
Inspired by Jon, I did a demo prorgram showing three ways to declare predicates, in for example the "FindIndex" and "FindLastIndex" methods of Lists, but in general you can do this for any...
4
by: Arun Srinivasan | last post by:
Hi I was using a query previously, that was efficient select * from table where pred1 and pred2 and pred3; Later I was asked to introduce new ones, but they were not based on table columns but...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.