Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tom Niget
typon
Commits
39585e1b
Commit
39585e1b
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some useful functions to PyStr
parent
1cae67e3
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 @
39585e1b
...
@@ -12,7 +12,7 @@ using namespace std::literals;
...
@@ -12,7 +12,7 @@ using namespace std::literals;
#include "bytes.hpp"
#include "bytes.hpp"
#include "print.hpp"
#include "print.hpp"
//#include <format>
//
#include <format>
#include <fmt/format.h>
#include <fmt/format.h>
class
PyStr
:
public
std
::
string
{
class
PyStr
:
public
std
::
string
{
...
@@ -22,6 +22,7 @@ public:
...
@@ -22,6 +22,7 @@ public:
PyStr
(
const
std
::
string
&
s
)
:
std
::
string
(
s
)
{}
PyStr
(
const
std
::
string
&
s
)
:
std
::
string
(
s
)
{}
PyStr
(
std
::
string
&&
s
)
:
std
::
string
(
std
::
move
(
s
))
{}
PyStr
(
std
::
string
&&
s
)
:
std
::
string
(
std
::
move
(
s
))
{}
PyStr
(
size_t
count
,
char
ch
)
:
std
::
string
(
count
,
ch
)
{}
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
>
template
<
class
InputIterator
>
PyStr
(
InputIterator
first
,
InputIterator
last
)
:
std
::
string
(
first
,
last
)
{}
PyStr
(
InputIterator
first
,
InputIterator
last
)
:
std
::
string
(
first
,
last
)
{}
...
@@ -33,6 +34,8 @@ public:
...
@@ -33,6 +34,8 @@ public:
template
<
typename
...
T
>
PyStr
format
(
T
&&
...
args
)
const
{
template
<
typename
...
T
>
PyStr
format
(
T
&&
...
args
)
const
{
return
PyStr
(
fmt
::
format
(
fmt
::
runtime
(
*
this
),
std
::
forward
<
T
>
(
args
)...));
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
{
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