Skip to content

Separate Storage of Value and Error in Result Class #58

Description

@threeal

Modify the Result class to store the value and error separately, enabling extraction using structured binding declaration as shown in the following example:

result::Result<Image> load_image(const std::filesystem::path& path);

int main() {
  const auto [image, error] = load_image(image_path);
  if (error) {
    // Handle the error case.
  } else {
    // Do something with the image.
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions