void  , both the reference type and the value type are inferred from ` Ref `  
---|---|---  
V  |  \-  |  the value type ( ` range_value_t ` ) of the generator, or  void   
Allocator  |  \-  |  an allocator type or  void   
  
If ` Allocator ` is not  void  , then the behavior is undefined if ` Allocator
` does not meet the [ Allocator  ](/w/cpp/named_req/Allocator "cpp/named
req/Allocator") requirements.

###  [ [ edit
](/mwiki/index.php?title=cpp/coroutine/generator&action=edit&section=2 "Edit
section: Member types") ]  Member types

Member type  |  Definition   
---|---  
` _value_ ` (private)  |  [ std::  conditional_t  ](http://en.cppreference.com/w/cpp/types/conditional) < [ std::  is_void_v  ](http://en.cppreference.com/w/cpp/types/is_void) < V  > , [ std::  remove_cvref_t  ](http://en.cppreference.com/w/cpp/types/remove_cvref) < Ref  > , V  > ;  .   
(  exposition-only member type*  )  
` _reference_ ` (private)  |  [ std::  conditional_t  ](http://en.cppreference.com/w/cpp/types/conditional) < [ std::  is_void_v  ](http://en.cppreference.com/w/cpp/types/is_void) < V  > , Ref  && , Ref  > ;  .   
(  exposition-only member type*  )  
` yielded ` |  [ std::  conditional_t  ](http://en.cppreference.com/w/cpp/types/conditional) < [ std::  is_reference_v  ](http://en.cppreference.com/w/cpp/types/is_reference) < reference  > , reference,  const  reference  & > .   
Type requirements  
---  
\-  [ std::  allocator_traits
](http://en.cppreference.com/w/cpp/memory/allocator_traits) < Allocator  > ::
pointer  is a pointer type.  
\-  ` _value_ ` is a cv-unqualified object type.  
\-  ` _reference_ ` is either a reference type, or a cv-unqualified object
type that models [ ` copy_constructible ` ](/w/cpp/concepts/copy_constructible
"cpp/concepts/copy constructible") .  
\-  Let  /*RRef*/  denote:  [ std::  remove_reference_t
](http://en.cppreference.com/w/cpp/types/remove_reference) < /*reference*/  >
&& , if  /*reference*/  is a reference type, and  /*reference*/  otherwise.

  * [ std::  common_reference_with  ](http://en.cppreference.com/w/cpp/concepts/common_reference_with) < /*reference*/  && ,  /*value*/  & > is modeled. 
  * [ std::  common_reference_with  ](http://en.cppreference.com/w/cpp/concepts/common_reference_with) < /*reference*/  && ,  /*RRef*/  && > is modeled. 
  * [ std::  common_reference_with  ](http://en.cppreference.com/w/cpp/concepts/common_reference_with) < /*RRef*/  && ,  const  /*value*/  & > is modeled. 

  
  
The program is ill-formed if any of these type requirements is not satisfied.

###  [ [ edit
](/mwiki/index.php?title=cpp/coroutine/generator&action=edit&section=3 "Edit
section: Member objects") ]  Member objects

Member name  |  Definition   
---|---  
` _active__ ` (private)  |  Internally, each active instance of ` std::generator ` is associated with a stack (handled as if by object of type  [ std::  unique_ptr  ](http://en.cppreference.com/w/cpp/memory/unique_ptr) < [ std::  stack  ](http://en.cppreference.com/w/cpp/container/stack) < [ std::  coroutine_handle  ](http://en.cppreference.com/w/cpp/coroutine/coroutine_handle) <>>> ). 

  * When [ ` begin ` ](/w/cpp/coroutine/generator/begin "cpp/coroutine/generator/begin") is called, a new stack is created and the generator is added to the stack. 
  * When  co_yield ranges  ::  elements_of  (  rng  )  is evaluated in a generator body,  rng  is converted to a generator and added to the stack that contains the enclosing generator. 
  * When a generator iterator is [ incremented ](/w/cpp/coroutine/generator/iterator#increment "cpp/coroutine/generator/iterator") , the coroutine at the top of the associated stack is resumed. 
  * When a generator finishes (i.e. when [ ` final_suspend ` ](/w/cpp/coroutine/generator/promise_type/final_suspend "cpp/coroutine/generator/promise type/final suspend") is called), it is removed from the stack.   
(  exposition-only member object*  )

  
` _coroutine__ ` (private)  |  a handle of type  [ std::  coroutine_h