File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ class Value {
169
169
MapProxy operator [](const std::string&);
170
170
const Value operator [](const char *) const ;
171
171
MapProxy operator [](const char *);
172
+ const Value operator [](char *) const ;
173
+ MapProxy operator [](char *);
172
174
const Value& operator [](int ) const ;
173
175
Value& operator [](int );
174
176
Original file line number Diff line number Diff line change @@ -390,6 +390,16 @@ MapProxy Value::operator[](const char *input) {
390
390
}
391
391
392
392
393
+ const Value Value::operator [](char *input) const {
394
+ return operator [](std::string (input));
395
+ }
396
+
397
+
398
+ MapProxy Value::operator [](char *input) {
399
+ return operator [](std::string (input));
400
+ }
401
+
402
+
393
403
const Value& Value::operator [](int index) const {
394
404
switch (prv->type )
395
405
{
Original file line number Diff line number Diff line change @@ -509,6 +509,16 @@ void test_value() {
509
509
assert (itConst == valConst.end ());
510
510
}
511
511
512
+ {
513
+ Hjson::Value val;
514
+ val[" first" ] = " leaf1" ;
515
+ char szKey[20 ];
516
+ sprintf (szKey, " first" );
517
+ assert (val[szKey] == " leaf1" );
518
+ char *szKey2 = szKey;
519
+ assert (val[szKey2] == " leaf1" );
520
+ }
521
+
512
522
{
513
523
Hjson::Value val;
514
524
You can’t perform that action at this time.
0 commit comments