|
Geometry : |
Subject: [ggl] namespace renaming
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-12-01 16:01:53
> If we touch renaming, perhaps we could agree on singular name
> as well (algorithm vs algorithms, geometry vs geometries),
> a std:: way. (bloody troublemaker me ;-))
>
;-)
Good point. The folders are called in plural (algorithms),
and (more important) the main namespace is already "geometry",
we don't get (compiler) confusions there? I expect we get...
>
>>> and thin wrappers in the domain specific namespaces either
>>> redefining or re-using/hoisting the existing algos from namespace
>>> algorithm.
>>>
>> I understand redefining/inlining and calling, but how can you hoist a
>> function with the using clause?
>>
>
> So called using declaration is applicable to types and functions,
> including operators:
>
> namespace mloskot {
> int add(int a, int b) { return a + b; }
> }
>
> int main()
> {
> using ::mloskot::add;
> int a(3), b(7);
> int c = add(a, b);
> return 0;
> }
>
I know, but we will use it differently (simplified):
namespace algorithm
{
inline int distance(point a, point b) { return
strategies::pythagoras(a,b); }
}
namespace ogc
{
inline int distance(point a, point b) { return
algorithm::distance(a,b); }
}
but the last function is "forwarding", the inline function call should
be optimized away, but it cannot be replaced by somthing with hoisting /
"using", AFAIK.
Barend
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20091201/9b2ed4a1/attachment.html
Geometry list run by mateusz at loskot.net