git rid of std::iterator

Fixes #194.

* spot/graph/graph.hh: Here.
This commit is contained in:
Alexandre Duret-Lutz 2017-01-18 10:30:10 +01:00
parent d80ca1fb47
commit 0e2ab5de53

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et // Copyright (C) 2014, 2015, 2016, 2017 Laboratoire de Recherche et
// Développement de l'Epita. // Développement de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -240,21 +240,18 @@ namespace spot
// of that list. // of that list.
template <typename Graph> template <typename Graph>
class SPOT_API edge_iterator: public class SPOT_API edge_iterator
std::iterator<std::forward_iterator_tag,
typename
std::conditional<std::is_const<Graph>::value,
const typename Graph::edge_storage_t,
typename Graph::edge_storage_t>::type>
{ {
typedef
std::iterator<std::forward_iterator_tag,
typename
std::conditional<std::is_const<Graph>::value,
const typename Graph::edge_storage_t,
typename Graph::edge_storage_t>::type>
super;
public: public:
typedef typename std::conditional<std::is_const<Graph>::value,
const typename Graph::edge_storage_t,
typename Graph::edge_storage_t>::type
value_type;
typedef value_type& reference;
typedef value_type* pointer;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
typedef typename Graph::edge edge; typedef typename Graph::edge edge;
edge_iterator() noexcept edge_iterator() noexcept
@ -277,14 +274,12 @@ namespace spot
return t_ != o.t_; return t_ != o.t_;
} }
typename super::reference reference operator*() const
operator*() const
{ {
return g_->edge_storage(t_); return g_->edge_storage(t_);
} }
typename super::pointer pointer operator->() const
operator->() const
{ {
return &g_->edge_storage(t_); return &g_->edge_storage(t_);
} }
@ -421,21 +416,19 @@ namespace spot
////////////////////////////////////////////////// //////////////////////////////////////////////////
template <typename Graph> template <typename Graph>
class SPOT_API all_edge_iterator: public class SPOT_API all_edge_iterator
std::iterator<std::forward_iterator_tag,
typename
std::conditional<std::is_const<Graph>::value,
const typename Graph::edge_storage_t,
typename Graph::edge_storage_t>::type>
{ {
typedef public:
std::iterator<std::forward_iterator_tag, typedef typename std::conditional<std::is_const<Graph>::value,
typename const typename Graph::edge_storage_t,
std::conditional<std::is_const<Graph>::value, typename Graph::edge_storage_t>::type
const typename Graph::edge_storage_t, value_type;
typename Graph::edge_storage_t>::type> typedef value_type& reference;
super; typedef value_type* pointer;
typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
protected:
typedef typename std::conditional<std::is_const<Graph>::value, typedef typename std::conditional<std::is_const<Graph>::value,
const typename Graph::edge_vector_t, const typename Graph::edge_vector_t,
typename Graph::edge_vector_t>::type typename Graph::edge_vector_t>::type
@ -487,14 +480,12 @@ namespace spot
return t_ != o.t_; return t_ != o.t_;
} }
typename super::reference reference operator*() const
operator*() const
{ {
return tv_[t_]; return tv_[t_];
} }
typename super::pointer pointer operator->() const
operator->() const
{ {
return &tv_[t_]; return &tv_[t_];
} }