Boost logo

Boost :

From: Sofus Mortensen (list_at_[hidden])
Date: 2002-03-07 15:26:43


I think I may have worked around the INTERNAL COMPILER ERROR for
tuples.hpp and MSVC7.0.

I accomplished this by "inlining" the add_reference implementation in
tuples::detail::element_ref and tuples::detail::element_const_ref. See
details below.

After applying the fix BGL also appears to be working on MSVC7.

Best regards,
Sofus Mortensen

http://www.sofusmortensen.com

tuple_basic_no_partial_spec.hpp, line 247:

    namespace detail {

                template <bool x>
                struct reference_adder
                {
                        template <class T>
                        struct rebind
                        {
                                typedef T& type;
                        };
                };

                template <>
                struct reference_adder<true>
                {
                        template <class T>
                        struct rebind
                        {
                                typedef T type;
                        };
                };

      // Return a reference to the Nth type of the given Tuple
      template<int N, typename Tuple>
      struct element_ref
      {
      private:
        typedef typename element<N, Tuple>::RET elt_type;
                  enum { is_ref = is_reference<elt_type>::value };

      public:
// typedef typename add_reference<elt_type>::type RET;
                  typedef
reference_adder<is_ref>::rebind<elt_type>::type RET;
        typedef RET type;
      };

      // Return a const reference to the Nth type of the given Tuple
      template<int N, typename Tuple>
      struct element_const_ref
      {
      private:
        typedef typename element<N, Tuple>::RET elt_type;
                  enum { is_ref = is_reference<elt_type>::value };

      public:
                  typedef reference_adder<is_ref>::rebind<const
elt_type>::type RET;
// typedef typename add_reference<const elt_type>::type RET;
        typedef RET type;
      };

    } // namespace detail


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