## Class template generator

hamigaki::coroutines::generator —

## Synopsis

    template<typename T>
    class generator {
    public:
      // types
      typedef shared_coroutine0<T>      coroutine_type;
      typedef selfN<R, T1, T2, ..., TN> self;
      typedef T                         value_type;
      typedef const T&                  reference;
      typedef const T*                  pointer;
      typedef implementation defined    difference_type;
      typedef std::input_iterator_tag   iterator_category;

      // construct/copy/destruct
      generator();
      template<typename Functor> explicit generator(Functor);

      // operators
      bool operator==(const generator&);
      bool operator!=(const generator&);
      const T& operator*() const;
      const T* operator->() const;
      generator& operator++();

      private: coroutine_type coro;
      private: T value;
    };

## Description

### `generator` construct/copy/destruct

1.     generator();

2.     template<typename Functor> explicit generator(Functor f);

   Effects: |
       coro = coroutine_type(f);
       value = coro(std::nothrow);

### `generator` operators

1.     bool operator==(const generator& rhs);

2.     bool operator!=(const generator& rhs);

3.     const T& operator*() const;

   Returns: | `value`

4.     const T* operator->() const;

   Returns: | `&value`

5.     generator& operator++();

   Effects: | `value = coro(std::nothrow)`
   Returns: | `*this`

| 製作著作 © 2006, 2007 Takeshi Mouri