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
c2cf0423
Commit
c2cf0423
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some useful functions to PyStr
parent
4600fea0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
rt/include/python/builtins/str.hpp
rt/include/python/builtins/str.hpp
+4
-1
No files found.
rt/include/python/builtins/str.hpp
View file @
c2cf0423
...
...
@@ -12,7 +12,7 @@ using namespace std::literals;
#include "bytes.hpp"
#include "print.hpp"
//#include <format>
//
#include <format>
#include <fmt/format.h>
class
PyStr
:
public
std
::
string
{
...
...
@@ -22,6 +22,7 @@ public:
PyStr
(
const
std
::
string
&
s
)
:
std
::
string
(
s
)
{}
PyStr
(
std
::
string
&&
s
)
:
std
::
string
(
std
::
move
(
s
))
{}
PyStr
(
size_t
count
,
char
ch
)
:
std
::
string
(
count
,
ch
)
{}
constexpr
PyStr
(
const
char
*
s
,
size_t
count
)
:
std
::
string
(
s
,
count
)
{}
template
<
class
InputIterator
>
PyStr
(
InputIterator
first
,
InputIterator
last
)
:
std
::
string
(
first
,
last
)
{}
...
...
@@ -33,6 +34,8 @@ public:
template
<
typename
...
T
>
PyStr
format
(
T
&&
...
args
)
const
{
return
PyStr
(
fmt
::
format
(
fmt
::
runtime
(
*
this
),
std
::
forward
<
T
>
(
args
)...));
}
bool
startswith
(
const
std
::
string
&
s
)
const
{
return
this
->
starts_with
(
s
);
}
};
inline
constexpr
PyStr
operator
""
_ps
(
const
char
*
s
,
size_t
len
)
noexcept
{
...
...
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