File: property.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 (18 lines) | stat: -rw-r--r-- 801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
property
========
*wrapper to specify read and write variable functionality using functions*

.. code-block:: cpp
	
	template <typename Read, typename Write>
	decltype(auto) property ( Read&& read_function, Write&& write_function );
	template <typename Read>
	decltype(auto) property ( Read&& read_function );
	template <typename Write>
	decltype(auto) property ( Write&& write_function );

These set of functions create a type which allows a setter and getter pair (or a single getter, or a single setter) to be used to create a variable that is either read-write, read-only, or write-only. When used during :doc:`usertype<usertype>` construction, it will create a variable that uses the setter/getter member function specified.

.. literalinclude:: ../../../examples/source/property.cpp
	:linenos: