Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
785414ed
Commit
785414ed
authored
Jul 27, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add builtin for lvalue_or_rvalue helper
parent
fd8f5b68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
rt/include/python/builtins.hpp
rt/include/python/builtins.hpp
+23
-0
No files found.
rt/include/python/builtins.hpp
View file @
785414ed
...
@@ -237,4 +237,27 @@ typon::Task<PyFile> open(const PyStr &path, std::string_view mode) {
...
@@ -237,4 +237,27 @@ typon::Task<PyFile> open(const PyStr &path, std::string_view mode) {
#include "../typon/generator.hpp"
#include "../typon/generator.hpp"
#include <pybind11/embed.h>
#include <pybind11/stl.h>
namespace
py
=
pybind11
;
#include <utility>
template
<
typename
Ref
>
struct
lvalue_or_rvalue
{
Ref
&&
ref
;
template
<
typename
Arg
>
constexpr
lvalue_or_rvalue
(
Arg
&&
arg
)
noexcept
:
ref
(
std
::
move
(
arg
))
{
}
constexpr
operator
Ref
&
()
const
&
noexcept
{
return
ref
;
}
constexpr
operator
Ref
&&
()
const
&&
noexcept
{
return
std
::
move
(
ref
);
}
constexpr
Ref
&
operator
*
()
const
noexcept
{
return
ref
;
}
constexpr
Ref
*
operator
->
()
const
noexcept
{
return
&
ref
;
}
};
#endif // TYPON_BUILTINS_HPP
#endif // TYPON_BUILTINS_HPP
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment