---
name: "ACE_Double_Linked_List_Iterator"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Double_Linked_List_Iterator"
---

# ACE\_Double\_Linked\_List\_Iterator(3)

Implements an iterator for a double linked list ADT

## NAME

ACE\_Double\_Linked\_List\_Iterator -  Implements an iterator for a double linked list ADT

## SYNOPSIS

```
#include <ace/Containers.h>
template<class T>
class ACE_Double_Linked_List_Iterator :
  public ACE_Double_Linked_List_Iterator_Base <T>
{
  public:
    ACE_Double_Linked_List_Iterator (ACE_Double_Linked_List<T> &);
    void reset (ACE_Double_Linked_List<T> &);
    int first (void);
    int advance (void);
    T* advance_and_remove (int dont_remove);
    ACE_Double_Linked_List_Iterator<T> & operator++ (void);
    ACE_Double_Linked_List_Iterator<T> operator++ (int);
    ACE_Double_Linked_List_Iterator<T> & operator-- (void);
    ACE_Double_Linked_List_Iterator<T> operator-- (int);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
};
```

## DESCRIPTION

Iterate thru the double-linked list.  This class provides an interface that let users access the internal element addresses directly. Notice class T must delcare ACE\_Double\_Linked\_ListT, ACE\_Double\_Linked\_List\_Iterator\_Base T and ACE\_Double\_Linked\_List\_Iterator as friend classes and class T should also have data members T\* next\_ and T\* prev\_.

## Initialization method.

```
ACE_Double_Linked_List_Iterator (ACE_Double_Linked_List<T> &);
```

```
void reset (ACE_Double_Linked_List<T> &);
```

Retasks the iterator to iterate over a new Double\_Linked\_List. This allows clients to reuse an iterator without incurring the constructor overhead. If you do use this, be aware that if there are more than one reference to this iterator, the other "clients" may be very bothered when their iterator changes. @@ Here be dragons. Comments?

```
int first (void);
```

Move to the first element in the list.  Returns 0 if the list is empty, else 1.

```
int advance (void);
```

Move forward by one element in the list.  Returns 0 when all the items in the list have been seen, else 1.

```
T* advance_and_remove (int dont_remove);
```

Advance the iterator while removing the original item from the list.  Return a pointer points to the original (removed) item. If dont\_remove equals 0, this function behaves like advance but return 0 (NULL) instead.

## STL-style iteration methods

```
ACE_Double_Linked_List_Iterator<T> & operator++ (void);
```

Prefix advance.

```
ACE_Double_Linked_List_Iterator<T> operator++ (int);
```

Postfix advance.

```
ACE_Double_Linked_List_Iterator<T> & operator-- (void);
```

Prefix reverse.

```
ACE_Double_Linked_List_Iterator<T> operator-- (int);
```

Postfix reverse.

```
void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## Initialization and termination methods.

## Check boundary conditions.

## Classic unordered set operations.

## LIBRARY

ace
