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
330ffd95
Commit
330ffd95
authored
Feb 08, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed reverse_iterators and fixed some bugs
parent
4c59ccd1
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
471 additions
and
102 deletions
+471
-102
src/json.hpp
src/json.hpp
+1
-51
src/json.hpp.re2c
src/json.hpp.re2c
+1
-51
test/unit.cpp
test/unit.cpp
+469
-0
No files found.
src/json.hpp
View file @
330ffd95
...
...
@@ -84,10 +84,6 @@ class basic_json
using
iterator
=
basic_json
::
iterator
;
/// a const iterator for a basic_json container
using
const_iterator
=
basic_json
::
const_iterator
;
// a reverse iterator for a basic_json container
using
reverse_iterator
=
std
::
reverse_iterator
<
iterator
>
;
/// a const reverse iterator for a basic_json container
using
const_reverse_iterator
=
std
::
reverse_iterator
<
const_iterator
>
;
///////////////////////////
...
...
@@ -259,8 +255,6 @@ class basic_json
std
::
enable_if
<
not
std
::
is_same
<
V
,
basic_json
::
iterator
>
::
value
and
not
std
::
is_same
<
V
,
basic_json
::
const_iterator
>::
value
and
not
std
::
is_same
<
V
,
basic_json
::
reverse_iterator
>::
value
and
not
std
::
is_same
<
V
,
basic_json
::
const_reverse_iterator
>::
value
and
std
::
is_constructible
<
basic_json
,
typename
V
::
value_type
>::
value
,
int
>::
type
=
0
>
inline
basic_json
(
const
V
&
value
)
...
...
@@ -732,18 +726,6 @@ class basic_json
return
m_value
.
object
->
operator
[](
key
);
}
/// access specified element
inline
reference
operator
[](
typename
object_t
::
key_type
&&
key
)
{
// at only works for objects
if
(
m_type
!=
value_t
::
object
)
{
throw
std
::
runtime_error
(
"cannot use [] with "
+
type_name
());
}
return
m_value
.
object
->
operator
[](
std
::
move
(
key
));
}
/// find an element in an object
inline
iterator
find
(
typename
object_t
::
key_type
key
)
...
...
@@ -824,38 +806,6 @@ class basic_json
return
result
;
}
/// returns a reverse iterator to the end of the container
inline
reverse_iterator
rbegin
()
const
noexcept
{
reverse_iterator
result
(
this
);
result
.
set_end
();
return
result
;
}
/// returns a reverse iterator to the beginning of the container
inline
reverse_iterator
rend
()
const
noexcept
{
reverse_iterator
result
(
this
);
result
.
set_begin
();
return
result
;
}
/// returns a const reverse iterator to the end of the container
inline
const_reverse_iterator
crbegin
()
const
noexcept
{
const_reverse_iterator
result
(
this
);
result
.
set_end
();
return
result
;
}
/// returns a const reverse iterator to the beginning of the container
inline
const_reverse_iterator
crend
()
const
noexcept
{
const_reverse_iterator
result
(
this
);
result
.
set_begin
();
return
result
;
}
//////////////
// capacity //
...
...
@@ -2326,7 +2276,7 @@ class basic_json
/// post-decrement (it--)
inline
const_iterator
operator
--
(
int
)
{
iterator
result
=
*
this
;
const_
iterator
result
=
*
this
;
switch
(
m_object
->
m_type
)
{
...
...
src/json.hpp.re2c
View file @
330ffd95
...
...
@@ -84,10 +84,6 @@ class basic_json
using iterator = basic_json::iterator;
/// a const iterator for a basic_json container
using const_iterator = basic_json::const_iterator;
// a reverse iterator for a basic_json container
using reverse_iterator = std::reverse_iterator<iterator>;
/// a const reverse iterator for a basic_json container
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
///////////////////////////
...
...
@@ -259,8 +255,6 @@ class basic_json
std::enable_if<
not std::is_same<V, basic_json::iterator>::value and
not std::is_same<V, basic_json::const_iterator>::value and
not std::is_same<V, basic_json::reverse_iterator>::value and
not std::is_same<V, basic_json::const_reverse_iterator>::value and
std::is_constructible<basic_json, typename V::value_type>::value, int>::type
= 0>
inline basic_json(const V& value)
...
...
@@ -732,18 +726,6 @@ class basic_json
return m_value.object->operator[](key);
}
/// access specified element
inline reference operator[](typename object_t::key_type&& key)
{
// at only works for objects
if (m_type != value_t::object)
{
throw std::runtime_error("cannot use [] with " + type_name());
}
return m_value.object->operator[](std::move(key));
}
/// find an element in an object
inline iterator find(typename object_t::key_type key)
...
...
@@ -824,38 +806,6 @@ class basic_json
return result;
}
/// returns a reverse iterator to the end of the container
inline reverse_iterator rbegin() const noexcept
{
reverse_iterator result(this);
result.set_end();
return result;
}
/// returns a reverse iterator to the beginning of the container
inline reverse_iterator rend() const noexcept
{
reverse_iterator result(this);
result.set_begin();
return result;
}
/// returns a const reverse iterator to the end of the container
inline const_reverse_iterator crbegin() const noexcept
{
const_reverse_iterator result(this);
result.set_end();
return result;
}
/// returns a const reverse iterator to the beginning of the container
inline const_reverse_iterator crend() const noexcept
{
const_reverse_iterator result(this);
result.set_begin();
return result;
}
//////////////
// capacity //
...
...
@@ -2326,7 +2276,7 @@ class basic_json
/// post-decrement (it--)
inline const_iterator operator--(int)
{
iterator result = *this;
const_
iterator result = *this;
switch (m_object->m_type)
{
...
...
test/unit.cpp
View file @
330ffd95
This diff is collapsed.
Click to expand it.
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