Skip to content

ajvengo/spike-expected

 
 

Repository files navigation

expected<T>

Variations on Expected<T> by Andrei Alexandrescu.

Refer to this blog for more information about exception_ptr lite for C++03.

Feature Comparison

Feature nonstd:: required std::pair std::optional nonstd:: expected Boost. Expected Nonco expected Andrei Expected
More information see [11] see [1] this work see [4] see [3] see [5]
C++03 yes yes no yes (subset) no (union) no no
C++11 yes yes yes no move sem. yet yes yes yes
DefaultConstructible no T param yes yes no no no
In-place construction no no yes no/not yet yes yes no
Literal type no yes yes no/not yet yes no no
Disengaged information no possible no yes yes yes yes
Vary disengaged type no yes no maybe yes no no
Engaged nonuse throws yes no no policy? no no no
Disengaged use throws n/a no yes, value() yes, value() yes, get() yes, get() yes, get()
Proxy (rel.ops) no no yes yes no no no
References no no yes no/not yet no yes no
Chained visitor(s) no no no maybe maybe no no

References

[1] Fernando Cacciola and Andrzej Krzemieński. A proposal to add a utility class to represent optional objects (Revision 4). ISO/IEC JTC1 SC22 WG21 N3672 2013-04-19.

[2] Andrzej Krzemieński, Optional library implementation in C++11.

[3] Anto Nonco. Extending expected to deal with references. 27 May 2013.

[4] Pierre Talbot. Boost.Expected. Unofficial Boost candidate. 5 May 2013. GitHub, GSoC 2013 Proposal, boost@lists.boost.org.

[5] Andrei Alexandrescu. Systematic Error Handling in C++. Prepared for The C++and Beyond Seminar 2012. Video. Slides.

[6] Andrei Alexandrescu. Choose your Poison: Exceptions or Error Codes? (PDF). ACCU Conference 2007.

[7] Andrei Alexandrescu. The Power of None (PPT). Northwest C++ Users' Group. May 17th, 2006.

[8] Jon Jagger. A Return Type That Doesn't Like Being Ignored. Overload issue 53, February 2003.

[9] Andrei Alexandrescu. Error Handling in C++: Are we inching towards a total solution?. ACCU Conference 2002.

[10] Ken Hagan et al. Exploding return codes. comp.lang.c++.moderated. 11 February 2000.

Notes

[11] nonstd::required: templated version of Ken Hagan's ReturnCode [10].

C++11 compiler support

Other

About

expected: kind of optional?

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published