Ignore:
Timestamp:
Apr 29, 2014, 3:40:53 AM (9 years ago)
Author:
Peter
Message:

refs #790. workaround for old boost

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamPairIterator.h

    r3193 r3197  
    2727#include "BamPair.h"
    2828#include "BamRead.h"
     29
     30#include <yat/utility/yat_assert.h>
    2931
    3032#include <boost/concept/assert.hpp>
     
    8486     */
    8587    explicit BamPairIterator(Base begin, Base end);
     88
     89#if BOOST_VERSION < 104900
     90    /**
     91       This is workaround implementation of operator-> when
     92       implementation in base class (boost) does not compile. This
     93       implementation may be slow, so when using old boost it often
     94       prefereble to use operator*.
     95     */
     96    typename BamPairIterator::pointer operator->(void) const
     97    {
     98      // older versions of boost mandates pointer to be
     99      // value_type*. To accomplish that we implement this slow thing
     100      // which keeps a copy of a value_type as member.
     101      // See https://svn.boost.org/trac/boost/ticket/5697 for discussion.
     102
     103      // Possibly stupid to assign each time, but why bother optimize
     104      // for old bugs in boost. Users who are eager for speed, should
     105      // either upgrade their boost or use (*iterator).function()
     106      // rather than iterator->function().
     107      YAT_ASSERT(mate_);
     108      YAT_ASSERT(iter_ != end_);
     109      dummie_.first() = *mate_;
     110      dummie_.second() = *iter_;
     111      return &dummie_;
     112    }
     113  private:
     114    mutable BamPair dummie_;
     115#endif
     116
    86117  private:
    87118    Base iter_;
Note: See TracChangeset for help on using the changeset viewer.