File: optional.rst

package info (click to toggle)
sol2 3.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,096 kB
  • sloc: cpp: 43,816; ansic: 1,018; python: 356; sh: 288; makefile: 202
file content (9 lines) | stat: -rw-r--r-- 700 bytes parent folder | download
1
2
3
4
5
6
7
8
9
optional<T>
===========

This is an implemention of `optional from the standard library`_. If it detects that a proper optional exists, it will attempt to use it. This is mostly an implementation detail, used in the :ref:`sol::stack::check_get<stack-check-get>` and :ref:`sol::stack::get\<optional\<T>><stack-get>` and ``sol::optional<T> maybe_value = table["arf"];`` implementations for additional safety reasons.

See `this example here`_ for a demonstration on how to use it and other features!

.. _optional from the standard library: http://en.cppreference.com/w/cpp/utility/optional
.. _this example here: https://github.com/ThePhD/sol2/blob/develop/examples/source/optional_with_iteration.cpp