Boost C++ Libraries

...one 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.
PrevUpHomeNext

Struct template code_as_error_t

boost::process::v2::code_as_error_t

Synopsis

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

template<typename CompletionToken> 
struct code_as_error_t {
  // construct/copy/destruct
  template<typename Token_> code_as_error_t(Token_ &&, const error_category &);

  // public data members
  CompletionToken token_;
  const error_category & category;
};

Description

Convert the exit-code in a completion into an error if the actual error isn't set.

process proc{ctx, "exit", {"1"}};

proc.async_wait(code_as_error(
   [](error_code ec)
   {
     assert(ec.value() == 10);
     assert(ec.category() == error::get_exit_code_category());
   }));

code_as_error_t public construct/copy/destruct

  1. template<typename Token_> 
      code_as_error_t(Token_ && token, const error_category & category);

PrevUpHomeNext