<html><body>
<DIV>This was from Apr 4 from :</DIV>
<DIV><A title="[Coin-discuss] Problem compiling OsiCuts under MS VC++ 2005&#10; (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&amp;In-Reply-To=">stefano_gliozzi at it.ibm.com </A></DIV>
<DIV>&nbsp;</DIV>
<DIV>"...</DIV>
<DIV>Hi all, <BR>I'm having some problems in compiling any optimization code which includes <BR>&nbsp;&nbsp; osicuts.hpp . <BR><BR>The MS VC++ 2005 compiler, complains on the following definition: <BR><BR>const OsiCut * OsiCuts::mostEffectiveCutPtr() const <BR>{ <BR>&nbsp; const_iterator b=begin();<BR>&nbsp; const_iterator e=end();<BR>&nbsp; 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&nbsp; are const_iterator and the compiler does not know how to <BR>treat them <BR><BR>..."</DIV>
<DIV>&nbsp;</DIV>
<DIV>Well, they are an interator, but a COIN-invented one ;-)&nbsp; .&nbsp; 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 &lt;iterator&gt; &lt;&lt; NEW LINE<BR>...</DIV>
<DIV>&nbsp;&nbsp; class const_iterator {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; friend class OsiCuts;<BR>&nbsp;&nbsp;&nbsp; public:<BR>&nbsp;&nbsp; typedef std::bidirectional_iterator_tag iterator_category; &lt;&lt;NEW LINE<BR>&nbsp;&nbsp; typedef OsiCut* value_type;&lt;&lt;NEW LINE<BR>&nbsp;&nbsp; typedef size_t difference_type;&lt;&lt;NEW LINE<BR>&nbsp;&nbsp; typedef OsiCut ** pointer;&lt;&lt;NEW LINE<BR>&nbsp;&nbsp; typedef OsiCut *&amp; reference;&lt;&lt;NEW LINE<BR></DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const_iterator(const OsiCuts&amp; cuts);<BR>...</DIV>
<DIV>&nbsp;</DIV>
<DIV>I suspect this is compatible with other compilers as it is adding traits to the iterator.</DIV>
<DIV>&nbsp;</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>