GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - nonstd-lite/optional-fun-lite: optional-fun lite - Functional algorithms for optional (lite) for C++98, C++11 and later in a single-file header-only library

BranchesTags
Open more actions menu

Latest commit

 

History

71 Commits
71 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cmake
cmake
 
 
include/nonstd
include/nonstd
 
 
project/CodeBlocks
project/CodeBlocks
 
 
script
script
 
 
test
test
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.tgitconfig
.tgitconfig
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 

Repository files navigation

optional-fun lite: C++23's monadic operations of optional for C++98 and later

This library is still under (unintense) development.

Language License Build Status Version download Try it online Try it on godbolt online

Contents

  • Example usage
  • In a nutshell
  • License
  • Dependencies
  • Installation
  • Synopsis
  • Other implementations
  • Notes and references
  • Appendix

Example usage

#include "nonstd/optional-fun.hpp"
#include <iostream>

int main(int argc, char **)
{
}

Compile and run

$ g++ -std=c++11 -Wall -I../include/ -o main.exe main.cpp && main.exe

In a nutshell

optional-fun lite is a single-file header-only library to provide C++23 monadic operations to C++17's class optional for use with C++98 and later.

Currently this library does not (yet) support ... .

Features and properties of optional-fun lite are ease of installation (single header), freedom of dependencies other than the standard library.

Limitations of optional-fun lite are ... [to be summed up].

License

optional-fun lite is distributed under the Boost Software License.

Dependencies

optional-fun lite has no other dependencies than the C++ standard library.

Installation

optional-fun lite is a single-file header-only library. Put optional-fun.hpp in the include folder directly into the project source tree or somewhere reachable from your project.

Synopsis

  • Documentation of class optional-fun
  • optional-fun lite implementation status
  • Configuration

Documentation of class optional-fun

[Envisioned] Depending on the compiler and C++ standard used, optional-fun lite behaves less or more like the standard's version. To get an idea of the capabilities of optional-fun lite with your configuration, look at the output of the tests, issuing optional-fun-main.t --pass @.

For the standard's documentation, see section Member functions, Monadic operations of class optional, which is part of the C++ Utility library.

optional-fun lite implementation status

Kind Type or function Notes
     

Configuration

Other implementations

  • optional. C++11/14/17 std::optional with functional-style extensions and reference support. Simon Brand.

Notes and references

[1] CppReference. Optional.

[2] ISO/IEC WG21. Draft 2022-11-11, section 22.5 Optional objects. 2022.

[3] ISO/IEC WG21. Draft 2022-11-11, section 22.5.3.7 Optional objects, Monadic operations. 2022.

[4] Simon Brand. p0798 - Monadic operations for std::optional. 2019.

Appendix

A.1 Compile-time information

The version of optional-fun lite is available via tag [.version]. The following tags are available for information on the compiler and on the C++ standard library used: [.compiler], [.stdc++], [.stdlanguage] and [.stdlibrary].

A.2 Optional-fun lite test specification

click to expand

optional-fun.t.cpp(28): passed: optional map(f): non-void[functional]: 2*v == (optional<int>(v) | map( double_int )).value() for 42 == 42
optional-fun.t.cpp(41): passed: optional map(f): void[functional]: monostate() == (optional<int>(v) | map( voider_int )).value() for [monostate] == [monostate]
optional-fun.t.cpp(50): passed: optional map_or(f): [functional]: 14 == (optional<int>( 7 ) | map_or( double_int, 42 )) for 14 == 14
optional-fun.t.cpp(51): passed: optional map_or(f): [functional]: 42 == (optional<int>( ) | map_or( double_int, 42 )) for 42 == 42
optional-fun.t.cpp(58): passed: optional map_or_else(f): [functional]: 14 == (optional<int>( 7 ) | map_or_else( double_int, seven )) for 14 == 14
optional-fun.t.cpp(59): passed: optional map_or_else(f): [functional]: 7 == (optional<int>( ) | map_or_else( double_int, seven )) for 7 == 7
optional-fun.t.cpp(69): passed: optional and_then(f): success[functional]: 2*v == (optional<int>(v) | then( double_opt )).value() for 42 == 42
optional-fun.t.cpp(70): passed: optional and_then(f): success[functional]: 2*v == (optional<int>(v) | and_then( double_opt )).value() for 42 == 42
optional-fun.t.cpp(78): passed: optional and_then(f): fail[functional]: ! ( (optional<int>(7) | and_then( double_opt ) | and_then( fail_opt ) | and_then( double_opt )).has_value() ) for ! ( false )
optional-fun.t.cpp(86): passed: optional or_else(f): non-void[functional]: -1 == (optional<int>(-1) | or_else( fun_or_else_nonvoid )).value() for -1 == -1
optional-fun.t.cpp(87): passed: optional or_else(f): non-void[functional]: fun_or_else_nonvoid() == (optional<int>( ) | or_else( fun_or_else_nonvoid )).value() for 7 == 7
optional-fun.t.cpp(92): passed: optional or_else(f): void[functional]: -1 == (optional<int>(-1) | or_else( fun_or_else_void )).value() for -1 == -1
optional-fun.t.cpp(93): passed: optional or_else(f): void[functional]: ! ( (optional<int>( ) | or_else( fun_or_else_void )).has_value() ) for ! ( false )
optional-fun.t.cpp(98): passed: optional and_(u): [functional]: 42 == (optional<int>(7) | and_( 42 )).value() for 42 == 42
optional-fun.t.cpp(99): passed: optional and_(u): [functional]: ! ( (optional<int>( ) | and_( 42 )).has_value() ) for ! ( false )
optional-fun.t.cpp(104): passed: optional or_(rhs): [functional]: 7 == (optional<int>(7) | or_( 42 )) for 7 == 7
optional-fun.t.cpp(105): passed: optional or_(rhs): [functional]: 42 == (optional<int>( ) | or_( 42 )) for 42 == 42

About

optional-fun lite - Functional algorithms for optional (lite) for C++98, C++11 and later in a single-file header-only library

Resources

Readme
BSL-1.0 license
Activity
Custom properties

Stars

12 stars

Watchers

2 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.