<html><body>
<DIV>This was from Apr 4 from :</DIV>
<DIV><A title="[Coin-discuss] Problem compiling OsiCuts under MS VC++ 2005 (Compiler Level 14.00.50.727.42)" href="mailto:coin-discuss%40list.coin-or.org?Subject=%5BCoin-discuss%5D%20Problem%20compiling%20OsiCuts%20under%20MS%20VC%2B%2B%202005%0A%20%28Compiler%20Level%2014.00.50.727.42%29&In-Reply-To=">stefano_gliozzi at it.ibm.com </A></DIV>
<DIV> </DIV>
<DIV>"...</DIV>
<DIV>Hi all, <BR>I'm having some problems in compiling any optimization code which includes <BR> osicuts.hpp . <BR><BR>The MS VC++ 2005 compiler, complains on the following definition: <BR><BR>const OsiCut * OsiCuts::mostEffectiveCutPtr() const <BR>{ <BR> const_iterator b=begin();<BR> const_iterator e=end();<BR> return *(std::min_element(b,e,OsiCutCompare()));<BR>}<BR><BR>and the issue ssems to be that b and e are not of iterator class, as <BR>expected, but are const_iterator and the compiler does not know how to <BR>treat them <BR><BR>..."</DIV>
<DIV> </DIV>
<DIV>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:</DIV>
<DIV>...</DIV>
<DIV>#include "CoinFloatEqual.hpp"<BR>#include <iterator> << NEW LINE<BR>...</DIV>
<DIV> class const_iterator {<BR> friend class OsiCuts;<BR> public:<BR> typedef std::bidirectional_iterator_tag iterator_category; <<NEW LINE<BR> typedef OsiCut* value_type;<<NEW LINE<BR> typedef size_t difference_type;<<NEW LINE<BR> typedef OsiCut ** pointer;<<NEW LINE<BR> typedef OsiCut *& reference;<<NEW LINE<BR></DIV>
<DIV> const_iterator(const OsiCuts& cuts);<BR>...</DIV>
<DIV> </DIV>
<DIV>I suspect this is compatible with other compilers as it is adding traits to the iterator.</DIV>
<DIV> </DIV>
<DIV>I've done a port to Vis Studio 2005 and it seems to work reasonably well. </DIV>
<DIV>HTH,</DIV>
<DIV>Philip</DIV></body></html>