Boost logo

Boost :

Subject: Re: [boost] [polygon] MSVC8 portability and MSVC8 bugs
From: Christian Henning (chhenning_at_[hidden])
Date: 2009-07-02 13:29:36


We have to make sure we are trying to compile the same code! The
following works when using MSVC8. There are three encompass functions.
Can you tell me if that's the right code?

#include "isotropy.hpp"
#include "rectangle_data.hpp"
#include "point_data.hpp"
#include "point_traits.hpp"
#include "interval_traits.hpp"
#include "rectangle_traits.hpp"
#include "point_concept.hpp"
#include "interval_concept.hpp"
//#include "rectangle_concept.hpp"

namespace boost { namespace polygon {

struct rectangle_concept{};

template <typename T>
struct geometry_concept< rectangle_data< T > >
{
typedef rectangle_concept type;
};

template <typename T>
struct is_mutable_rectangle_concept { typedef gtl_no type; };
template <>
struct is_mutable_rectangle_concept< rectangle_concept > { typedef
gtl_yes type; };

template <typename T>
struct is_rectangle_concept { typedef gtl_no type; };
template <>
struct is_rectangle_concept< rectangle_concept > { typedef gtl_yes type; };

template< typename rectangle_type
        , typename interval_type
>
bool
encompass( rectangle_type& rectangle
         , const interval_type& b
         , orientation_2d orient
         , typename enable_if< typename gtl_and< typename
is_mutable_rectangle_concept< typename geometry_concept<
rectangle_type >::type >::type
                                               , typename
is_interval_concept < typename geometry_concept< interval_type
>::type >::type
>::type
                             , bool
>::type* ptr = 0
         )
{
    return true;
}

// enlarge rectangle to encompass the Rectangle b
template < typename rectangle_type_1
         , typename rectangle_type_2
>
bool
encompass( rectangle_type_1& rectangle
         , const rectangle_type_2& b
         , typename enable_if< typename gtl_and< typename
is_mutable_rectangle_concept<typename
geometry_concept<rectangle_type_1>::type>::type
                                               , typename
is_rectangle_concept<typename
geometry_concept<rectangle_type_2>::type>::type
>::type
                             , void
>::type* dummy = 0
      )
{
    return true;
}

// enlarge rectangle to encompass the point b
template <typename rectangle_type_1, typename point_type>
bool
encompass( rectangle_type_1& rectangle
         , const point_type& b
         , typename enable_if< typename gtl_and< typename
is_mutable_rectangle_concept< typename
geometry_concept<rectangle_type_1 >::type>::type
                                               , typename
is_point_concept < typename geometry_concept<point_type
>::type>::type
>::type
                             , void
>::type* dummy = 0
         )
{
    return true;
}

}
}

int main()
{
    using namespace boost;
    using namespace boost::polygon;
    rectangle_data<int> r;
    point_data<int> p;

    encompass(r, p);
    return 0;
}

Christian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk