Topic: identity
Author: Ian Haggard <ian@shellus.com>
Date: 1997/02/03 Raw View
In article <fxtlo998w1p.fsf@isolde.mti.sgi.com>,
Matt Austern <austern@sgi.com> wrote:
> The function object identity<T> is not part of the C++ draft standard.
> We have included it because we believe that it is an essential part of
> any collection of function objects, and we hope that it will be
> adopted either as part of the upcoming standard or in a future round
> of standardization.
As long as we're doing identity, Maybe we should do the S, K, and Y
combinators, too. :^)
For all you non Scheme-fanatics, the definitions of these combinators
are expressed like so:
(I x) = x
((K x) y) = x
(((S f) g) x) = ((f x) (g x))
(Y f) = (f (Y f))
By the way, you can reduce any functional-language expression to a
combination of the I,S, and K combinators, so this might not be too bad
of an idea. Oh, for those college days, when I remembered how write Y
in terms of I,S, and K :^)
--
Ian Haggard || ian@shellus.com (work) || IanHaggard@juno.com (home)
Linux -- "Oh, no, Mr Bill!" || #define employer_opinion !my_opinion
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Enno Rehling <enno@uni-paderborn.de>
Date: 1997/01/31 Raw View
This is a short one:
the STL implementation uses a class identity<T> which is not included in
my HP version of the STL - is this one SGI-specific, or is it in the
current draft?
Enno
--- Excerpt from function.h ---
template <class T>
struct identity : public unary_function<T, T> {
const T& operator()(const T& x) const { return x; }
};
--
email: enno@uni-paderborn.de
WWW: http://pbhrzs0.uni-paderborn.de/~q09960/public/
phone: Int+ 49 5251-760796
smail: Kilianstr. 129a
33098 Paderborn / Germany
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Matt Austern <austern@sgi.com>
Date: 1997/01/31 Raw View
Enno Rehling <enno@uni-paderborn.de> writes:
> This is a short one:
>
> the STL implementation uses a class identity<T> which is not included in
> my HP version of the STL - is this one SGI-specific, or is it in the
> current draft?
>
> Enno
> --- Excerpt from function.h ---
> template <class T>
> struct identity : public unary_function<T, T> {
> const T& operator()(const T& x) const { return x; }
> };
The function object identity<T> is not part of the C++ draft standard.
We have included it because we believe that it is an essential part of
any collection of function objects, and we hope that it will be
adopted either as part of the upcoming standard or in a future round
of standardization.
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]