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
e60e458a
Commit
e60e458a
authored
Jan 15, 2017
by
Théo DELRIEU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move static_const to the detail namespace
parent
794dae89
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
26 deletions
+24
-26
json.hpp
src/json.hpp
+12
-13
json.hpp.re2c
src/json.hpp.re2c
+12
-13
No files found.
src/json.hpp
View file @
e60e458a
...
@@ -797,6 +797,16 @@ public:
...
@@ -797,6 +797,16 @@ public:
}
}
};
};
// taken from ranges-v3
template
<
typename
T
>
struct
static_const
{
static
constexpr
T
value
{};
};
template
<
typename
T
>
constexpr
T
static_const
<
T
>::
value
;
/*!
/*!
@brief helper class to create locales with decimal point
@brief helper class to create locales with decimal point
...
@@ -818,21 +828,10 @@ struct DecimalSeparator : std::numpunct<char>
...
@@ -818,21 +828,10 @@ struct DecimalSeparator : std::numpunct<char>
};
};
}
}
// taken from ranges-v3
// TODO add doc
template
<
typename
T
>
struct
static_const
{
static
constexpr
T
value
{};
};
template
<
typename
T
>
constexpr
T
static_const
<
T
>::
value
;
inline
namespace
inline
namespace
{
{
constexpr
const
auto
&
to_json
=
static_const
<
detail
::
to_json_fn
>::
value
;
constexpr
const
auto
&
to_json
=
detail
::
static_const
<
detail
::
to_json_fn
>::
value
;
constexpr
const
auto
&
from_json
=
static_const
<
detail
::
from_json_fn
>::
value
;
constexpr
const
auto
&
from_json
=
detail
::
static_const
<
detail
::
from_json_fn
>::
value
;
}
}
// default JSONSerializer template argument, doesn't care about template argument
// default JSONSerializer template argument, doesn't care about template argument
...
...
src/json.hpp.re2c
View file @
e60e458a
...
@@ -797,6 +797,16 @@ public:
...
@@ -797,6 +797,16 @@ public:
}
}
};
};
// taken from ranges-v3
template <typename T>
struct static_const
{
static constexpr T value{};
};
template <typename T>
constexpr T static_const<T>::value;
/*!
/*!
@brief helper class to create locales with decimal point
@brief helper class to create locales with decimal point
...
@@ -818,21 +828,10 @@ struct DecimalSeparator : std::numpunct<char>
...
@@ -818,21 +828,10 @@ struct DecimalSeparator : std::numpunct<char>
};
};
}
}
// taken from ranges-v3
// TODO add doc
template <typename T>
struct static_const
{
static constexpr T value{};
};
template <typename T>
constexpr T static_const<T>::value;
inline namespace
inline namespace
{
{
constexpr const auto & to_json = static_const<detail::to_json_fn>::value;
constexpr const auto & to_json =
detail::
static_const<detail::to_json_fn>::value;
constexpr const auto & from_json = static_const<detail::from_json_fn>::value;
constexpr const auto & from_json =
detail::
static_const<detail::from_json_fn>::value;
}
}
// default JSONSerializer template argument, doesn't care about template argument
// default JSONSerializer template argument, doesn't care about template argument
...
...
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