Topic: Extending N4371 (incomplete type support for standard


Author: itsjimporter@gmail.com
Date: Thu, 19 Jul 2018 12:07:30 -0700 (PDT)
Raw View
------=_Part_3974_857690352.1532027250411
Content-Type: multipart/alternative;
 boundary="----=_Part_3975_824393317.1532027250411"

------=_Part_3975_824393317.1532027250411
Content-Type: text/plain; charset="UTF-8"

Has there been any recent work to extend incomplete type support for
standard containers to other containers? I care mainly about `std::map`,
and from my reading of N3890
<http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3890.html>, the
main stumbling block to extending support across all containers is for
`std::deque`. I wasn't able to find any followups to N4371, and I'm unsure
if there's any resistance to extending this piecemeal. With incomplete type
support for `std::map`, representing a JSON object in C++ should become
relatively straightforward:

struct json : std::variant<
  double,
  std::string,
  std::vector<json>,
  std::map<std::string, json> // not allowed (yet)...
> {
   using std::variant</*...*/>::variant;
};

This would eliminate the need to use things like Boost's
`make_recursive_variant` for common cases like JSON (and similar) data
types without requiring full recursive-variant support in the standard. I'm
happy to help push this forward, but my understanding is that the main
concern is what standard library implementers think of this.

- Jim

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/cca7f2c4-daae-4e48-830d-ae5ff3e1c36c%40isocpp.org.

------=_Part_3975_824393317.1532027250411
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Has there been any recent work to extend incomplete t=
ype support for standard containers to other containers? I care mainly abou=
t `std::map`, and from my reading of <a href=3D"http://www.open-std.org/JTC=
1/SC22/WG21/docs/papers/2014/n3890.html">N3890</a>, the main stumbling bloc=
k to extending support across all containers is for `std::deque`. I wasn&#3=
9;t able to find any followups to N4371, and I&#39;m unsure if there&#39;s =
any resistance to extending this piecemeal. With incomplete type support fo=
r `std::map`, representing a JSON object in C++ should become relatively st=
raightforward:</div><div><br></div><div style=3D"background-color: rgb(250,=
 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-w=
idth: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> json </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">var=
iant</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">double</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">string</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 std</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">vector</span><span style=3D"color: #080;" cla=
ss=3D"styled-by-prettify">&lt;json&gt;</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">map</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">string</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> json</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// not allowed (yet)...</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">variant</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&lt;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">/*..=
..*/</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">variant</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">};</span></div></code></div>=
<div></div><div><br></div><div>This would eliminate the need to use things =
like Boost&#39;s `make_recursive_variant` for common cases like JSON (and s=
imilar) data types without requiring full recursive-variant support in the =
standard. I&#39;m happy to help push this forward, but my understanding is =
that the main concern is what standard library implementers think of this.<=
br></div><div><br></div><div>- Jim<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/cca7f2c4-daae-4e48-830d-ae5ff3e1c36c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cca7f2c4-daae-4e48-830d-ae5ff3e1c36c=
%40isocpp.org</a>.<br />

------=_Part_3975_824393317.1532027250411--

------=_Part_3974_857690352.1532027250411--

.