Boost logo

Geometry :

Subject: Re: [geometry] Run-Time specified geometries
From: Samuel Debionne (samuel.debionne_at_[hidden])
Date: 2013-12-04 09:05:39

Hello Bruno,
thanks for the tip ! That seems to solve the problem with
not_implemented and the compiler goes a bit further.
Now it bumps in other MPL_ASSERT that are in the algorithms::detail
namespaces such as for_each_range. My attempt for these errors is :

    typename Tag,
    typename Geometry,
    typename Actor,
    bool IsConst
struct for_each_range

    static inline void apply(
                    const Geometry&,
                    const Actor&)
        throw not_implemented_error();
            , (types<Geometry>)

I did the same thing for sectionize. May be it could be factorized in
one place (just like you did with not_implemented).

My main issue right now is with the instantiation of some metafunctions
such as range_type<Geometry> that MPL_ASSERT as well. Since they are
pure metafunctions there is no way to trigger a runtime error and the pb
has to be handled upstream. Any idea on this one ?

I'm also a bit worried about code bloat (but I don't have any evidence
yet). Maybe I should think of a way to filter algorithms not implemented
for a given combination of types at the source...

Here is what I have in not_implemented.hpp so far :


struct not_implemented_error : public std::exception {};

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
        // and doesn't assume anything about T
        T* t;
        return *t;

    typename Term1 = void,
    typename Term2 = void,
    typename Term3 = void
struct not_implemented
    : nyi::not_implemented_tag
    template <typename Term1>
    inline static
    not_implemented_result apply(Term1) {throw not_implemented_error();}

    template <typename Term1, typename Term2>
    inline static
    not_implemented_result apply(Term1, Term2) {throw

    template <typename Term1, typename Term2, typename Term3>
    inline static
    not_implemented_result apply(Term1, Term2, Term3) {throw


// MPL static error

BTW, I'm using MSVC11. I known that different compilers have different
strategies when it comes to template instantiations.

Thanks again for your help,

Geometry list run by mateusz at