Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
a7bdf08c
Commit
a7bdf08c
authored
Sep 09, 2011
by
Jesse Beder
Browse files
Map iterator works\!
parent
cf198080
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
util/value.cpp
util/value.cpp
+12
-3
No files found.
util/value.cpp
View file @
a7bdf08c
...
@@ -3,13 +3,22 @@
...
@@ -3,13 +3,22 @@
int
main
()
int
main
()
{
{
YAML
::
Value
value
(
YAML
::
ValueType
::
Sequence
);
YAML
::
Value
value
;
value
[
"seq"
]
=
YAML
::
Value
(
YAML
::
ValueType
::
Sequence
);
for
(
int
i
=
0
;
i
<
5
;
i
++
)
for
(
int
i
=
0
;
i
<
5
;
i
++
)
value
.
append
(
i
);
value
[
"seq"
].
append
(
i
);
value
[
"map"
][
"one"
]
=
"I"
;
value
[
"map"
][
"two"
]
=
"II"
;
value
[
"map"
][
"three"
]
=
"III"
;
value
[
"map"
][
"four"
]
=
"IV"
;
for
(
YAML
::
const_iterator
it
=
value
.
begin
();
it
!=
value
.
end
();
++
it
)
{
for
(
YAML
::
const_iterator
it
=
value
[
"seq"
]
.
begin
();
it
!=
value
[
"seq"
]
.
end
();
++
it
)
{
std
::
cout
<<
it
->
as
<
int
>
()
<<
"
\n
"
;
std
::
cout
<<
it
->
as
<
int
>
()
<<
"
\n
"
;
}
}
for
(
YAML
::
const_iterator
it
=
value
[
"map"
].
begin
();
it
!=
value
[
"map"
].
end
();
++
it
)
{
std
::
cout
<<
it
->
first
.
as
<
std
::
string
>
()
<<
" -> "
<<
it
->
second
.
as
<
std
::
string
>
()
<<
"
\n
"
;
}
return
0
;
return
0
;
}
}
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