[Coin-discuss] Re: Problem compiling OsiCuts under MS VC++ 2005 (Compiler Level 14.00.50.727.42)
hpwalton at comcast.net
hpwalton at comcast.net
Thu Apr 27 11:58:41 EDT 2006
This was from Apr 4 from :
stefano_gliozzi at it.ibm.com
"...
Hi all,
I'm having some problems in compiling any optimization code which includes
osicuts.hpp .
The MS VC++ 2005 compiler, complains on the following definition:
const OsiCut * OsiCuts::mostEffectiveCutPtr() const
{
const_iterator b=begin();
const_iterator e=end();
return *(std::min_element(b,e,OsiCutCompare()));
}
and the issue ssems to be that b and e are not of iterator class, as
expected, but are const_iterator and the compiler does not know how to
treat them
..."
Well, they are an interator, but a COIN-invented one ;-) . We can "make it work" for MSVC (might not work everywhere, and I haven't verified it breaks anything) by adding the following new lines in the code in COIN/Osi/include/OsiCust.hpp:
...
#include "CoinFloatEqual.hpp"
#include <iterator> << NEW LINE
...
class const_iterator {
friend class OsiCuts;
public:
typedef std::bidirectional_iterator_tag iterator_category; <<NEW LINE
typedef OsiCut* value_type;<<NEW LINE
typedef size_t difference_type;<<NEW LINE
typedef OsiCut ** pointer;<<NEW LINE
typedef OsiCut *& reference;<<NEW LINE
const_iterator(const OsiCuts& cuts);
...
I suspect this is compatible with other compilers as it is adding traits to the iterator.
I've done a port to Vis Studio 2005 and it seems to work reasonably well.
HTH,
Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20060427/8c5c04c2/attachment.html>
More information about the Coin-discuss
mailing list