Boost logo

Geometry :

Subject: [ggl] namespace renaming
From: Mateusz Loskot (mateusz)
Date: 2009-12-01 15:49:16


Barend Gehrels wrote:
>> For GGL this might be a bit more difficult as the names are different, or
>> similar names refer to different things. One solution could be to have a
>> independent sub namespace (i.e. algorithm) containing all the shared
>> implementations
>
> This sounds like a convenient name, and solution.

Yes, indeed.

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 ;-))

>> 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;
}

>> This way you'll end up with some domain agnostic core and domain specific
>> wrappers around this.
>>
> I think this basically is a good solution.
>
> We then get:
> boost::geometry::algorithms::distance (the agnostic namespace)
> boost::geometry::ogc::distance (forwarding the call)
> boost::geometry::cg::distance (forwarding the call)
>
> For the algorithms not (yet) categorized, uses can call:
> boost::geometry::algorithms::simplify (not (yet) categorized

+1

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

Geometry list run by mateusz at loskot.net