File: as_returns.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 (19 lines) | stat: -rw-r--r-- 527 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
as_returns
==========
*turn an iterable argument into a multiple-return type*


.. code-block:: cpp
	
	template <typename T>
	struct as_returns_t { ... };

	template <typename T>
	as_returns_t<T> as_returns( T&& );


This allows you to wrap up a source that has ``begin`` and ``end`` iterator-returning functions on it and return it as multiple results into Lua. To have more control over the returns, use :doc:`sol::variadic_results<variadic_results>`.


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