Skip to content

Commit

Permalink
Initial round of upgrading tutorial and documentation for Outcome v2.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
ned14 committed Dec 14, 2020
1 parent bbde4ec commit f9e7477
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 47 deletions.
2 changes: 1 addition & 1 deletion doc/src/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enableGitInfo = true

[[menu.shortcuts]]
pre = "<h3>More</h3>"
name = "<i class='fa fa-github'></i> Outcome 2.1 github repo"
name = "<i class='fa fa-github'></i> Outcome 2.2 github repo"
identifier = "ds"
url = "https://github.com/ned14/outcome"
weight = 10
Expand Down
10 changes: 5 additions & 5 deletions doc/src/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ title = "Home"
{{% boost-copyright %}}

{{% notice note %}}
The final release of Outcome v2.1 will be in Boost 1.75 (end of 2020). From Boost 1.76
(start of 2021) onwards Outcome v2.2 shall become the default. Please consider upgrading
your code now to v2.2 using [the v2.1 => v2.2 upgrade guide]({{% relref "/changelog/upgrade_v21_v22" %}}).
The v2.2 branch has a number of major breaking changes to Outcome v2.1, see
At the end of December 2020, Outcome v2.2 replaced v2.1 in develop branch. This is a breaking
change and all Outcome v2.1 code will need to be upgraded using [the v2.1 => v2.2 upgrade guide]({{% relref "/changelog/upgrade_v21_v22" %}}). See also
[the list of v2.2 major changes]({{% relref "/changelog/v22" %}}).
<br><br>
This library's tutorial remains v2.1 based. It shall be ported to v2.2 in early 2021.
This library's tutorial is currently being converted from v2.1 to v2.2, so be aware some code
examples may not compile correctly yet. Once the documentation is fully upgraded, develop branch
shall be merged into master branch.
{{% /notice %}}

Outcome is a set of tools for reporting and handling function failures in contexts where *directly* using C++ exception handling is unsuitable. Such contexts include:
Expand Down
21 changes: 14 additions & 7 deletions doc/src/content/changelog/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ weight = 80
+++

---
## v2.1.5 11th December 2020 (Boost 1.75) [[release]](https://github.com/ned14/outcome/releases/tag/v2.1.5)
## v2.2.0 ? (Boost 1.76) [[release]](https://github.com/ned14/outcome/releases/tag/v2.2.0)

{{% notice note %}}
The v2.1 branch is expected to be retired end of 2020 with the Boost 1.75 release, with the v2.2 branch
becoming the default for Boost 1.76 onwards. You can use the future v2.2 branch now using
[`better_optimisation`](https://github.com/ned14/outcome/tree/better_optimisation),
how to upgrade your code is described in [the v2.1 => v2.2 upgrade guide]({{% relref "/changelog/upgrade_v21_v22" %}}).
BREAKING CHANGE As announced for a year and three Boost releases, Outcome v2.2 became the default, replacing v2.1.
: All v2.1 Outcome code will need to be upgraded as described in [the v2.1 => v2.2 upgrade guide]({{% relref "/changelog/upgrade_v21_v22" %}}).
This branch has a number of major breaking changes to Outcome v2.1, see
[the list of v2.2 major changes]({{% relref "/changelog/v22" %}}).
{{% /notice %}}

### Enhancements:

VS2019.8 compatibility
: VS2019.8 changed how to enable Coroutines, which caused Outcome to not compile on that compiler.

### Bug fixes:


---
## v2.1.5 11th December 2020 (Boost 1.75) [[release]](https://github.com/ned14/outcome/releases/tag/v2.1.5)

### Enhancements:

Expand Down
2 changes: 1 addition & 1 deletion doc/src/snippets/error_code_enums2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ result<udt> boo()
}
result<udt> foo()
{
OUTCOME_TRY(auto &&v, (boo()));
OUTCOME_TRY(auto v, (boo()));
return udt{5}; // emplace construct udt with 5
}
//! [usage3]
6 changes: 3 additions & 3 deletions doc/src/snippets/finale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ namespace app
// that into a httplib_error exception type which is stored as an exception ptr. The
// TRY operation below will return that exception ptr to be rethrown in the caller.
// Otherwise the fetched data is returned in a std::string data.
OUTCOME_TRY(auto &&data, ext(httplib::get("http://www.nedproductions.biz/")));
OUTCOME_TRY(auto data, ext(httplib::get("http://www.nedproductions.biz/")));
string_view data_view(data);

// HTML tidy the fetched data. If the C library fails due to an error corresponding to
Expand All @@ -397,11 +397,11 @@ namespace app
// TRY operation below will return that exception ptr to be rethrown in the caller.
// Otherwise the tidied data is returned into holdmem, with the string view updated to
// point at the tidied data.
OUTCOME_TRY(auto &&holdmem, ext(tidy_html(data_view)));
OUTCOME_TRY(auto holdmem, ext(tidy_html(data_view)));

// Write the tidied data to some file. If the write fails, synthesise a filesystem_error
// exception ptr exactly as if one called filelib::write_file(data_view).value().
OUTCOME_TRY(auto &&written, ext(filelib::write_file(data_view)));
OUTCOME_TRY(auto written, ext(filelib::write_file(data_view)));
return success();
}
} // namespace app
Expand Down
2 changes: 1 addition & 1 deletion doc/src/snippets/foreign_try.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ForeignExpected<int> old_code(int a) // old code

outcome::result<int> new_code(int a) // new code
{
OUTCOME_TRY(auto &&x, old_code(a));
OUTCOME_TRY(auto x, old_code(a));
return x;
}
//! [functions]
Expand Down
2 changes: 1 addition & 1 deletion doc/src/snippets/intro_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ outcome::result<int> process(const string& content) noexcept;

outcome::result<int> int_from_file(string_view path) noexcept
{
OUTCOME_TRY(auto &&str, data_from_file(path));
OUTCOME_TRY(auto str, data_from_file(path));
// if control gets here data_from_file() has succeeded
return process(str); // decltype(str) == string
}
Expand Down
2 changes: 1 addition & 1 deletion doc/src/snippets/using_outcome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace old
//! [def_h]
auto old::h() noexcept -> outcome::outcome<int>
{
OUTCOME_TRY(auto &&i, (g())); // #1
OUTCOME_TRY(auto i, (g())); // #1

try {
return i + f();
Expand Down
6 changes: 3 additions & 3 deletions include/outcome/detail/revision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Distributed under the Boost Software License, Version 1.0.
*/

// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 6ca680fe10892cdd44173327a7e1bde12afc5784
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-10-09 09:48:05 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 6ca680fe
#define OUTCOME_PREVIOUS_COMMIT_REF bbde4ec13b1f9fec23d2ec2b1064e9295f4d9e27
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-12-14 10:10:19 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE bbde4ec1
2 changes: 1 addition & 1 deletion include/outcome/experimental/status-code
4 changes: 2 additions & 2 deletions include/outcome/outcome.natvis
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="outcome_v2_6ca680fe::basic_outcome&lt;*&gt;">
<Type Name="outcome_v2_bbde4ec1::basic_outcome&lt;*&gt;">
<DisplayString Condition="(_state._status.status_value &amp; 0xff) == 0">empty</DisplayString>
<DisplayString Condition="(_state._status.status_value &amp; 1) == 1">value {{{_state._value}}}</DisplayString>
<DisplayString Condition="(_state._status.status_value &amp; 2) == 2">error {{{_state._error}}}</DisplayString>
Expand All @@ -21,7 +21,7 @@
<Item Condition="(_state._status.status_value &amp; 4) == 4" Name="[exception]">_ptr</Item>
</Expand>
</Type>
<Type Name="outcome_v2_6ca680fe::basic_result&lt;*&gt;">
<Type Name="outcome_v2_bbde4ec1::basic_result&lt;*&gt;">
<DisplayString Condition="(_state._status.status_value &amp; 0xff) == 0">empty</DisplayString>
<DisplayString Condition="(_state._status.status_value &amp; 1) == 1">value {{{_state._value}}}</DisplayString>
<DisplayString Condition="(_state._status.status_value &amp; 2) == 2">error {{{_state._error}}}</DisplayString>
Expand Down
12 changes: 6 additions & 6 deletions single-header/outcome-basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,9 @@ Distributed under the Boost Software License, Version 1.0.
#endif
#ifndef QUICKCPPLIB_DISABLE_ABI_PERMUTATION
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define QUICKCPPLIB_PREVIOUS_COMMIT_REF 10bf175bddec2aac1bebec46475fc3e85d755843
#define QUICKCPPLIB_PREVIOUS_COMMIT_DATE "2020-10-27 16:17:30 +00:00"
#define QUICKCPPLIB_PREVIOUS_COMMIT_UNIQUE 10bf175b
#define QUICKCPPLIB_PREVIOUS_COMMIT_REF b1fac941934e8d9ac3e82b02cf1264a829860d32
#define QUICKCPPLIB_PREVIOUS_COMMIT_DATE "2020-11-25 14:28:07 +00:00"
#define QUICKCPPLIB_PREVIOUS_COMMIT_UNIQUE b1fac941
#endif
#define QUICKCPPLIB_VERSION_GLUE2(a, b) a##b
#define QUICKCPPLIB_VERSION_GLUE(a, b) QUICKCPPLIB_VERSION_GLUE2(a, b)
Expand Down Expand Up @@ -961,9 +961,9 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 6ca680fe10892cdd44173327a7e1bde12afc5784
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-10-09 09:48:05 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 6ca680fe
#define OUTCOME_PREVIOUS_COMMIT_REF bbde4ec13b1f9fec23d2ec2b1064e9295f4d9e27
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-12-14 10:10:19 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE bbde4ec1
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2, OUTCOME_PREVIOUS_COMMIT_UNIQUE))
#else
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2))
Expand Down
20 changes: 11 additions & 9 deletions single-header/outcome-experimental.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,9 @@ Distributed under the Boost Software License, Version 1.0.
#endif
#ifndef QUICKCPPLIB_DISABLE_ABI_PERMUTATION
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define QUICKCPPLIB_PREVIOUS_COMMIT_REF 10bf175bddec2aac1bebec46475fc3e85d755843
#define QUICKCPPLIB_PREVIOUS_COMMIT_DATE "2020-10-27 16:17:30 +00:00"
#define QUICKCPPLIB_PREVIOUS_COMMIT_UNIQUE 10bf175b
#define QUICKCPPLIB_PREVIOUS_COMMIT_REF b1fac941934e8d9ac3e82b02cf1264a829860d32
#define QUICKCPPLIB_PREVIOUS_COMMIT_DATE "2020-11-25 14:28:07 +00:00"
#define QUICKCPPLIB_PREVIOUS_COMMIT_UNIQUE b1fac941
#endif
#define QUICKCPPLIB_VERSION_GLUE2(a, b) a##b
#define QUICKCPPLIB_VERSION_GLUE(a, b) QUICKCPPLIB_VERSION_GLUE2(a, b)
Expand Down Expand Up @@ -986,9 +986,9 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 6ca680fe10892cdd44173327a7e1bde12afc5784
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-10-09 09:48:05 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 6ca680fe
#define OUTCOME_PREVIOUS_COMMIT_REF bbde4ec13b1f9fec23d2ec2b1064e9295f4d9e27
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-12-14 10:10:19 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE bbde4ec1
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2, OUTCOME_PREVIOUS_COMMIT_UNIQUE))
#else
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2))
Expand Down Expand Up @@ -6140,7 +6140,7 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef SYSTEM_ERROR2_STATUS_ERROR_HPP
#define SYSTEM_ERROR2_STATUS_ERROR_HPP
/* Proposed SG14 status_code
(C) 2018 - 2019 Niall Douglas <http://www.nedproductions.biz/> (5 commits)
(C) 2018 - 2020 Niall Douglas <http://www.nedproductions.biz/> (5 commits)
File Created: Feb 2018


Expand Down Expand Up @@ -7005,6 +7005,8 @@ template <> class SYSTEM_ERROR2_TRIVIAL_ABI status_code<void>
: _domain(v)
{
}
// Used to work around triggering a ubsan failure. Do NOT remove!
constexpr const status_code_domain *_domain_ptr() const noexcept { return _domain; }
public:
//! Return the status code domain.
constexpr const status_code_domain &domain() const noexcept { return *_domain; }
Expand Down Expand Up @@ -7287,14 +7289,14 @@ template <class ErasedType> class SYSTEM_ERROR2_TRIVIAL_ABI status_code<erased<E
&& detail::type_erasure_is_safe<value_type, typename DomainType::value_type>::value,
bool>::type = true>
constexpr status_code(const status_code<DomainType> &v) noexcept // NOLINT
: _base(typename _base::_value_type_constructor{}, &v.domain(), detail::erasure_cast<value_type>(v.value()))
: _base(typename _base::_value_type_constructor{}, v._domain_ptr(), detail::erasure_cast<value_type>(v.value()))
{
}
//! Implicit move construction from any other status code if its value type is trivially copyable or move bitcopying and it would fit into our storage
template <class DomainType, //
typename std::enable_if<detail::type_erasure_is_safe<value_type, typename DomainType::value_type>::value, bool>::type = true>
SYSTEM_ERROR2_CONSTEXPR14 status_code(status_code<DomainType> &&v) noexcept // NOLINT
: _base(typename _base::_value_type_constructor{}, &v.domain(), detail::erasure_cast<value_type>(v.value()))
: _base(typename _base::_value_type_constructor{}, v._domain_ptr(), detail::erasure_cast<value_type>(v.value()))
{
v._domain = nullptr;
}
Expand Down
12 changes: 6 additions & 6 deletions single-header/outcome.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ Distributed under the Boost Software License, Version 1.0.
#endif
#ifndef QUICKCPPLIB_DISABLE_ABI_PERMUTATION
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define QUICKCPPLIB_PREVIOUS_COMMIT_REF 10bf175bddec2aac1bebec46475fc3e85d755843
#define QUICKCPPLIB_PREVIOUS_COMMIT_DATE "2020-10-27 16:17:30 +00:00"
#define QUICKCPPLIB_PREVIOUS_COMMIT_UNIQUE 10bf175b
#define QUICKCPPLIB_PREVIOUS_COMMIT_REF b1fac941934e8d9ac3e82b02cf1264a829860d32
#define QUICKCPPLIB_PREVIOUS_COMMIT_DATE "2020-11-25 14:28:07 +00:00"
#define QUICKCPPLIB_PREVIOUS_COMMIT_UNIQUE b1fac941
#endif
#define QUICKCPPLIB_VERSION_GLUE2(a, b) a##b
#define QUICKCPPLIB_VERSION_GLUE(a, b) QUICKCPPLIB_VERSION_GLUE2(a, b)
Expand Down Expand Up @@ -987,9 +987,9 @@ Distributed under the Boost Software License, Version 1.0.
http://www.boost.org/LICENSE_1_0.txt)
*/
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
#define OUTCOME_PREVIOUS_COMMIT_REF 6ca680fe10892cdd44173327a7e1bde12afc5784
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-10-09 09:48:05 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE 6ca680fe
#define OUTCOME_PREVIOUS_COMMIT_REF bbde4ec13b1f9fec23d2ec2b1064e9295f4d9e27
#define OUTCOME_PREVIOUS_COMMIT_DATE "2020-12-14 10:10:19 +00:00"
#define OUTCOME_PREVIOUS_COMMIT_UNIQUE bbde4ec1
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2, OUTCOME_PREVIOUS_COMMIT_UNIQUE))
#else
#define OUTCOME_V2 (QUICKCPPLIB_BIND_NAMESPACE_VERSION(outcome_v2))
Expand Down

0 comments on commit f9e7477

Please sign in to comment.