Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
e9fde3e1
Commit
e9fde3e1
authored
Oct 08, 2016
by
Vladimir Petrigo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make has_mapped_type struct friendly
parent
a0ef5a19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
json.hpp
src/json.hpp
+6
-3
json.hpp.re2c
src/json.hpp.re2c
+6
-3
No files found.
src/json.hpp
View file @
e9fde3e1
...
...
@@ -112,10 +112,13 @@ template<typename T>
struct
has_mapped_type
{
private
:
template
<
typename
C
>
static
char
test
(
typename
C
::
mapped_type
*
);
template
<
typename
C
>
static
char
(
&
test
(...))[
2
];
template
<
typename
U
,
typename
=
typename
U
::
mapped_type
>
static
int
detect
(
U
&&
);
static
void
detect
(...);
public
:
static
constexpr
bool
value
=
sizeof
(
test
<
T
>
(
0
))
==
1
;
static
constexpr
bool
value
=
std
::
is_integral
<
decltype
(
detect
(
std
::
declval
<
T
>
()))
>::
value
;
};
/*!
...
...
src/json.hpp.re2c
View file @
e9fde3e1
...
...
@@ -112,10 +112,13 @@ template<typename T>
struct has_mapped_type
{
private:
template<typename C> static char test(typename C::mapped_type*);
template<typename C> static char (&test(...))[2];
template <typename U, typename = typename U::mapped_type>
static int detect(U&&);
static void detect(...);
public:
static constexpr bool value = sizeof(test<T>(0)) == 1;
static constexpr bool value =
std::is_integral<decltype(detect(std::declval<T>()))>::value;
};
/*!
...
...
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