Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Struct current_view

boost::process::v2::environment::current_view — A view object for the current environment of this process.


// In header: <boost/process/v2/environment.hpp>

struct current_view {
  // types
  typedef environment::native_handle_type native_handle_type;
  typedef key_value_pair_view             value_type;        

  // member classes/structs/unions

  struct iterator {
    // types
    typedef key_value_pair_view       value_type;       
    typedef int                       difference_type;  
    typedef key_value_pair_view       reference;        
    typedef key_value_pair_view       pointer;          
    typedef std::forward_iterator_tag iterator_category;

    // construct/copy/destruct
    iterator() = default;
    iterator(const iterator &) = default;
    iterator(const native_iterator &);

    // public member functions
    iterator & operator++();
    iterator operator++(int);
    key_value_pair_view operator *() const;

  // construct/copy/destruct
  current_view() = default;
  current_view(current_view &&) = default;

  // public member functions
  native_handle_type native_handle();
  iterator begin() const;
  iterator end() const;


The view might (windows) or might not (posix) be owning; if it owns it will deallocate the on destruction, like a unique_ptr.

Note that accessing the environment in this way is not thread-safe.

void dump_my_env(current_view env = current())
   for (auto  & [k, v] : env)
       std::cout << k.string() << " = "  << v.string() << std::endl;

current_view public construct/copy/destruct

  1. current_view() = default;
  2. current_view(current_view && nt) = default;

current_view public member functions

  1. native_handle_type native_handle();
  2. iterator begin() const;
  3. iterator end() const;