Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
b5664110
Commit
b5664110
authored
Aug 30, 2014
by
Philipp A. Hartmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve EN/DISABLEIF macros to support complex templated parameters
parent
d63a40a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
Doxyfile
build/Doxyfile
+3
-1
document.h
include/rapidjson/document.h
+4
-4
meta.h
include/rapidjson/internal/meta.h
+15
-1
No files found.
build/Doxyfile
View file @
b5664110
...
...
@@ -1993,7 +1993,9 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = \
RAPIDJSON_DOXYGEN_RUNNING \
RAPIDJSON_DISABLEIF_RETURN(cond,returntype)=returntype
RAPIDJSON_REMOVEFPTR_(x)=x \
RAPIDJSON_ENABLEIF_RETURN(cond,returntype)="RAPIDJSON_REMOVEFPTR_ returntype" \
RAPIDJSON_DISABLEIF_RETURN(cond,returntype)="RAPIDJSON_REMOVEFPTR_ returntype"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
...
...
include/rapidjson/document.h
View file @
b5664110
...
...
@@ -588,7 +588,7 @@ public:
use \ref SetBool() instead.
*/
template
<
typename
T
>
RAPIDJSON_DISABLEIF_RETURN
(
internal
::
IsPointer
<
T
>
,
GenericValue
&
)
RAPIDJSON_DISABLEIF_RETURN
(
(
internal
::
IsPointer
<
T
>
),
(
GenericValue
&
)
)
operator
=
(
T
value
)
{
GenericValue
v
(
value
);
return
*
this
=
v
;
...
...
@@ -683,7 +683,7 @@ public:
//! Equal-to operator with primitive types
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c true, \c false
*/
template
<
typename
T
>
RAPIDJSON_DISABLEIF_RETURN
(
internal
::
IsPointer
<
T
>
,
bool
)
operator
==
(
const
T
&
rhs
)
const
{
return
*
this
==
GenericValue
(
rhs
);
}
template
<
typename
T
>
RAPIDJSON_DISABLEIF_RETURN
(
(
internal
::
IsPointer
<
T
>
),
(
bool
)
)
operator
==
(
const
T
&
rhs
)
const
{
return
*
this
==
GenericValue
(
rhs
);
}
//! Not-equal-to operator
/*! \return !(*this == rhs)
...
...
@@ -934,7 +934,7 @@ public:
\note Amortized Constant time complexity.
*/
template
<
typename
T
>
RAPIDJSON_DISABLEIF_RETURN
(
internal
::
IsPointer
<
T
>
,
GenericValue
&
)
RAPIDJSON_DISABLEIF_RETURN
(
(
internal
::
IsPointer
<
T
>
),
(
GenericValue
&
)
)
AddMember
(
StringRefType
name
,
T
value
,
Allocator
&
allocator
)
{
GenericValue
n
(
name
);
GenericValue
v
(
value
);
...
...
@@ -1147,7 +1147,7 @@ int z = a[0u].GetInt(); // This works too.
\note Amortized constant time complexity.
*/
template
<
typename
T
>
RAPIDJSON_DISABLEIF_RETURN
(
internal
::
IsPointer
<
T
>
,
GenericValue
&
)
RAPIDJSON_DISABLEIF_RETURN
(
(
internal
::
IsPointer
<
T
>
),
(
GenericValue
&
)
)
PushBack
(
T
value
,
Allocator
&
allocator
)
{
GenericValue
v
(
value
);
return
PushBack
(
v
,
allocator
);
...
...
include/rapidjson/internal/meta.h
View file @
b5664110
...
...
@@ -66,6 +66,9 @@ struct IsMoreConst {
};
};
//////////////////////////////////////////////////////////////////////////
// EnableIf / DisableIf
//
template
<
bool
Condition
,
typename
T
=
void
>
struct
EnableIfCond
;
template
<
typename
T
>
struct
EnableIfCond
<
true
,
T
>
{
typedef
T
Type
;
};
template
<
typename
T
>
struct
EnableIfCond
<
false
,
T
>
{
/* empty */
};
...
...
@@ -92,8 +95,19 @@ template <typename T> struct RemoveSfinaeFptr<SfinaeResultTag&(*)(T)> { typedef
typename
::
rapidjson
::
internal
::
EnableIf
\
<
RAPIDJSON_REMOVEFPTR_
(
cond
)
>::
Type
*
=
NULL
#define RAPIDJSON_DISABLEIF(cond) \
typename
::
rapidjson
::
internal
::
DisableIf
\
<
RAPIDJSON_REMOVEFPTR_
(
cond
)
>::
Type
*
=
NULL
#define RAPIDJSON_ENABLEIF_RETURN(cond,returntype) \
typename
::
rapidjson
::
internal
::
EnableIf
\
<
RAPIDJSON_REMOVEFPTR_
(
cond
),
\
RAPIDJSON_REMOVEFPTR_
(
returntype
)
>::
Type
#define RAPIDJSON_DISABLEIF_RETURN(cond,returntype) \
typename
::
rapidjson
::
internal
::
DisableIf
<
cond
,
returntype
>::
Type
typename
::
rapidjson
::
internal
::
DisableIf
\
<
RAPIDJSON_REMOVEFPTR_
(
cond
),
\
RAPIDJSON_REMOVEFPTR_
(
returntype
)
>::
Type
}
// namespace internal
}
// namespace rapidjson
...
...
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