Commit Graph

36 Commits

Author SHA1 Message Date
Florian Albrechtskirchinger
5352856f04
Implement support for string_view (attempt no. 3) (#3423)
* Add key_compare member to ordered_map

* Replace == with key_compare in ordered_map

* Expose the actual comparison function used by object_t

nlohmann::ordered_map uses a different comparison function than the one
provided via template parameter.
* Introduce a type trait to detect if object_t has a key_compare member.
* Rename object_comparator_t to default_object_comparator_t.
* Add object_comparator_t to be conditionally defined as
  object_t::key_compare, if available, or default_object_comparator_t
  otherwise.
* Update the documentation accordingly.

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

* Add type traits to check if a type is usable as object key

Add type trait to check:
* if a type is a specialization of a template.
* if a type is a json_pointer.
* if a type is a basic_json::{const_,}iterator.
* if two types are comparable using a given comparison functor.
* if a type is comparable to basic_json::object_t::key_type.
* if a type has a member type is_transparent.
* if a type is usable as object key.
* if a type has an erase() function accepting a given KeyType.

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

* Rework basic_json element access to accept more key types

Rework basic_json element access member functions and operators to
accept any type that meets the requirements defined by type trait
detail::is_usable_as_key_type.

Member functions and operators:
* at()
* operator[]
* value()
* erase()
* find()
* count()
* contains()

Update documentation to reflect these changes.

Add unit tests to excercise the new functions using std::string_view.

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
2022-04-29 21:40:02 +02:00
Niels Lohmann
a6ee8bf9d9
Overwork documentation (#3444)
* 📝 overwork macro documentation

* 📝 address review comments

* 🔧 add style check to Makefile

* 🙈 overwork .gitignore

* 📌 Pygments 2.12.0 is broken

* ✏️ fix links

* 🚸 adjust output to cppcheck

* 📝 add titles to more admonitions

* ✏️ fix typos

* 📝 document future behavior change
2022-04-25 22:40:45 +02:00
JungHoon Lee
a94430615d
Fix typo in basic_json documentation (#3439) 2022-04-12 15:58:06 +02:00
Michael Nosthoff
15fa6a342a
at.md: fix typo (#3426) 2022-04-06 15:26:35 +02:00
Niels Lohmann
ef556019be
📝 overwork documentation 2022-01-09 14:32:38 +01:00
Dimitris Apostolou
b785783440
Fix typo (#3249) 2022-01-05 13:35:14 +01:00
Niels Lohmann
a8e86ba948
📝 improve documentation InputType and IteratorType (#3246) 2022-01-04 15:02:39 +01:00
Niels Lohmann
29cd970b94
Consolidate documentation (#3071)
* 🔥 consolidate documentation
* ♻️ overwork std specializations
* 🚚 move images files to mkdocs
* ♻️ fix URLs
* 🔧 tweak MkDocs configuration
* 🔧 add namespaces
* 📝 document deprecations
* 📝 document documentation generation
* 🚸 improve search
* 🚸 add examples
* 🚧 start adding documentation for macros
* 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139
* 📝 overwork example handling
* 📝 fix Markdown tables
2021-12-29 13:41:01 +01:00
Dirk Stolle
fe230334d9
fix typos in documentation (#3140)
* fix typos in documentation

* revert changes to ChangeLog.md
2021-11-14 14:25:14 +01:00
Niels Lohmann
5d87c4d409
Add recursive update function (#3069)
*  add recursive update function
2021-11-03 13:52:20 +01:00
Niels Lohmann
c4a4e672fd
📝 add examples for parsing from iterator pair (#3100) 2021-10-29 21:26:41 +02:00
Cristi Vîjdea
f5b3fb326c
Fix typos in operator[] documentation (#3102)
* Fix typos in operator[] documentation
* Fix additional typo
2021-10-20 21:59:33 +02:00
mb0202
7194245a31
Fixed typo in parse.md (#2968)
Changed a potential typo: "charater" -> "character"
2021-08-24 08:08:02 +02:00
Niels Lohmann
8cae9d7cd2
Overwork warning flags (#2936)
* ⚗️ update warning flags
2021-08-17 14:43:43 +02:00
Niels Lohmann
523f7c2c9d
💡 update documentation 2021-08-08 13:24:17 +02:00
Niels Lohmann
cdfe865486
📝 add documentation for numbers 2021-04-28 20:33:05 +02:00
Niels Lohmann
b386f4de0b
📝 fix and extend documentation of discarded values 2020-08-19 20:26:06 +02:00
Niels Lohmann
3be6ee3525
🚚 remove < from filename to fix Windows build 2020-08-16 21:39:40 +02:00
Niels Lohmann
fe507a7ee8
🚚 remove < from filename to fix Windows build 2020-08-16 21:36:21 +02:00
Niels Lohmann
6b04f05eba
📝 add more API documentation 2020-08-16 21:23:44 +02:00
Niels Lohmann
5c4cc20ed8
📝 add more API documentation 2020-08-16 20:48:10 +02:00
Niels Lohmann
a430d25f22
📝 add more API documentation 2020-08-16 14:48:48 +02:00
Niels Lohmann
fb5c20134f
📝 add more API documentation 2020-08-16 14:27:26 +02:00
Niels Lohmann
d8ed98a7af
📝 add more API documentation 2020-08-15 15:18:07 +02:00
Niels Lohmann
f6c2947f1e
📝 add more API documentation 2020-08-14 13:47:54 +02:00
Niels Lohmann
0356e0c75b
📝 add more API documentation 2020-08-14 13:05:16 +02:00
Niels Lohmann
6674561d6a
📝 add more API documentation 2020-08-14 10:48:32 +02:00
Niels Lohmann
298420263b
🚚 remove quotes from filename to fix Windows build 2020-08-13 15:12:41 +02:00
Niels Lohmann
dd2fb3b454
📝 add more API documentation 2020-08-13 15:03:28 +02:00
Niels Lohmann
ce6adc447a
📝 add more API documentation 2020-08-13 14:04:08 +02:00
Niels Lohmann
178125ff9b
📝 add docset 2020-08-13 10:52:20 +02:00
Niels Lohmann
874f49e945
📝 add more API documentation 2020-08-12 14:29:25 +02:00
Niels Lohmann
fe89049aee
📝 add more API documentation 2020-08-12 13:41:59 +02:00
Niels Lohmann
c006fc9bec
📝 add more documentation 2020-07-27 14:07:13 +02:00
Niels Lohmann
7bd6242f04
📝 add more documentation 2020-07-25 22:00:28 +02:00
Niels Lohmann
6e5be17b62
📝 add more documentation 2020-07-25 14:40:50 +02:00