Boost logo

Geometry :

Subject: Re: [geometry] Run-Time specified geometries
From: Bruno Lalande (bruno.lalande_at_[hidden])
Date: 2013-12-03 18:13:51


Hi Samuel,

The parameters to pass to not_implemented are basically free, it's anything
you want to see appear in the compile error message it triggers. Concretely
algorithms, pass the tags of the geometries they are called with.

I had thought about your issue. I hadn't had the time to give it much
thought yet but the first thing I'd try would be to return an instance of
some not_implemented_result which would be implicitly convertible to
anything.

struct not_implemented_result
{
    template <class T>
    operator T()
    {
        // This will never actually happen - we just need to write something
        // that hopefully all compilers are happy with (ideally without
warnings)
        // and doesn't assume anything about T
        T* t;
        return *T;
    }
};

template <...>
struct not_implemented: ...
{
    template <class Arg1>
    static not_implemented_result apply(Arg1)
    { throw .... }

    // overloads with more arguments - as we don't have c++11 variadics
available
};

The implicit conversion ensures the compiler will always accept to compile
the call, thus giving a chance for the exception to occur at runtime. I'm
not saying it will work, but that would be my first attempt...

Regards
Bruno



Geometry list run by mateusz at loskot.net