On Friday 07 June 2002 10:18 am, Lars Gullik Bjønnes wrote:
> Angus Leeming <[EMAIL PROTECTED]> writes:
> | I have got as far as FormPreferences in my attempts to get lyx to compile
> | with cxx 6.5. Now I'm a little stuck.
> |
> | We have not defined an operator=() for class Converters and I'm getting
> | the following error message. What's the best way to resolve this?
> |
> | I guess that defining operator=() as below is possible, but do we want it
> | and if not what's the solution?
>
> Are you able to create a testcase for this error?
> I am not sure that the compiler is right.
> | cxx: Error: /usr/lib/cmplrs/cxx/V6.5-021/include/cxx/deque, line 574:
> | #468 a template argument may not reference a local type
>
> What template argument and what local type.... eh it isn't complaining
> about something in its own headers?

Perhaps someone was trying to be too clever. 

The error:
cxx: Error: /usr/lib/cmplrs/cxx/V6.5-021/include/cxx/deque, line 574: #468 a
          template argument may not reference a local type
          detected during:
            instantiation of "std::deque<T, Allocator> &std::deque<T,
                      Allocator>::operator=(const std::deque<T, Allocator> &)
                      [with T=int, Allocator=std::allocator<int>]" at line 469
                      of "../../devel/src/lyx_main.C"
            implicit generation of "std::queue<int, std::deque<int,
                      std::allocator<int>>> &std::queue<T,
                      Container>::operator=(const std::queue<int,
                      std::deque<int, std::allocator<int>>> &) [with T=int,
                      Container=std::deque<int, std::allocator<int>>]" at line
                      469 of "../../devel/src/lyx_main.C"
            implicit generation of
                      "Converters &Converters::operator=(const Converters &)"
                      at line 469 of "../../devel/src/lyx_main.C"
          copy(x.begin() + size(), x.end(),
----------^

is cured by:
   deque<T,Allocator>& operator= (const deque<T,Allocator>& x)
    {
      if (!(this == &x))
      {
        if (size() >= x.size()) 
          erase(copy(x.begin(), x.end(), begin()), end());
-        else
-          copy(x.begin() + size(), x.end(),
-               inserter(*this,copy(x.begin(),x.begin()+size(),begin())));
+        else {
+         const_iterator mid = x.begin() + difference_type(size());
+         copy(x.begin(), mid, begin());
+         insert(end(), mid, x.end());
+       }
      }
      return *this;
    }


which is exactly what GNU's gcc-3.1 does here.

Angus


Reply via email to