This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Function Object inlining
- From: Ian Lance Taylor <iant at google dot com>
- To: "Wesley Smith" <wesley dot hoke at gmail dot com>
- Cc: "MSX to GCC" <gcc-help at gcc dot gnu dot org>
- Date: 15 Oct 2007 21:37:01 -0700
- Subject: Re: Function Object inlining
- References: <1079b050710150725w2b211b63ic71c6d14755e995f@mail.gmail.com>
"Wesley Smith" <wesley.hoke@gmail.com> writes:
> I was reading about the implementation of the Computational Geometry
> and Algorithms Library (www.cgal.org) recently and one particular
> thing struck me. They mentioned things like
>
> template<class T>
> class Calc_something
> {
> operator()(T &t1, T& t2) {...}
>
> };
>
>
> when used in a context like
>
>
> ...
> Point p1(0, 0, 0);
> Point p2(1, 0, 0)
> Calc_something()(p1, p2);
>
> are inlined in many cases by the compiler. Is this the case?
Yes.
> Are things like this fairly straightforward optimizations?
Yes.
Ian