Hi.

This _very_ ugly patch fixes a build issue with GCC-3.4. The new
compiler complains about the variables 'c' and 'comp' - these two
variables are protected in the _Base parent class.

The patch "fixes" this problem by explicitly listing these variables as
part of _Base. I say fixes with the quotes because this approach relies
on these variables never being renamed in the libstdc headers, so this
fix is really little more than a workaround.

I've been having horrible luck with the CVS repo, so what I'm posting
below is the my snippet of changed code in the lib/Timer.hh file.

Change the code from this ...
inline void release(const _Tp& value) {
  c.erase(std::remove(c.begin(), c.end(), value), c.end());
  // after removing the item we need to make the heap again
  std::make_heap(c.begin(), c.end(), comp);
}

... to this ...

inline void release(const _Tp& value) {
  _Base::c.erase(std::remove(_Base::c.begin(), _Base::c.end(), value), _Base::c.end());
  // after removing the item we need to make the heap again
  std::make_heap(_Base::c.begin(), _Base::c.end(), _Base::comp);
}

With this change blackbox compiles with GCC-3.4.

A less hackish solution would probably do something like make a
temporary priority queue, then pull the values out of the _Base priority
queue and stick them in the temporary one if it (the freshly removed
queue object) does not equal "value", then once _Base is empty fill it
back up with the objects in our temporary priority queue. As my C++
skills are limited I'm not sure how to code this, or if there is a
better approach.

There is a filed bug report this patch addresses - bug number 793732.

I've compiled blackbox with this patch, but I'm not running it just yet.
I'd be interested in hearing if older GCC versions accept this code as
well.

Art Haas

-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
List archives:  http://asgardsrealm.net/lurker/splash/index.html
Trouble? Contact [EMAIL PROTECTED]

Reply via email to