Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
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
Libraries
json
Commits
3d305590
Commit
3d305590
authored
Jun 11, 2018
by
Vitaliy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
define global operator< for const char* and alt_string
parent
4feb8211
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
test/src/unit-alt-string.cpp
test/src/unit-alt-string.cpp
+13
-1
No files found.
test/src/unit-alt-string.cpp
View file @
3d305590
...
@@ -106,7 +106,12 @@ class alt_string
...
@@ -106,7 +106,12 @@ class alt_string
}
}
template
<
typename
op_type
>
template
<
typename
op_type
>
bool
operator
<
(
op_type
&&
op
)
const
typename
std
::
enable_if
<
// disable for alt_string
!
std
::
is_same
<
alt_string
,
typename
std
::
remove_reference
<
op_type
>::
type
>::
value
,
bool
>::
type
operator
<
(
op_type
&&
op
)
const
{
{
return
str_impl
<
op
;
return
str_impl
<
op
;
}
}
...
@@ -153,6 +158,8 @@ class alt_string
...
@@ -153,6 +158,8 @@ class alt_string
private:
private:
std
::
string
str_impl
;
std
::
string
str_impl
;
friend
bool
::
operator
<
(
const
char
*
,
const
alt_string
&
);
};
};
...
@@ -168,6 +175,11 @@ using alt_json = nlohmann::basic_json <
...
@@ -168,6 +175,11 @@ using alt_json = nlohmann::basic_json <
nlohmann
::
adl_serializer
>
;
nlohmann
::
adl_serializer
>
;
bool
operator
<
(
const
char
*
op1
,
const
alt_string
&
op2
)
{
return
op1
<
op2
.
str_impl
;
}
TEST_CASE
(
"alternative string type"
)
TEST_CASE
(
"alternative string type"
)
{
{
...
...
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