Genericizing move_to for range_attribute

Aaron Graham <[email protected]> Mon, 31 May 2021 10:44:16 -0700
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CADXX4PT_buOYdE7sGRHjLtz4kPWEA++y83eMyhd0suZdZZjJfw@mail.gmail.com>
--===============0257131171138728644==
Content-Type: multipart/alternative; boundary="000000000000d9130205c3a3c6ba"

--000000000000d9130205c3a3c6ba
Content-Type: text/plain; charset="UTF-8"

Currently, traits specializes move_to only for boost::iterator_range. This
leaves all the other potential ranges out. I wonder why it's not more
generically specified for ranges as it is for containers. I.e.:

--- boost_1_76_0/boost/spirit/home/x3/support/traits/move_to.hpp
       2021-04-
13 09:23:01.000000000 -0700
+++ boost_mine/boost/spirit/home/x3/support/traits/move_to.hpp  2021-05-31
10:34
:21.950810803 -0700
@@ -182,11 +182,11 @@
            traits::move_to(first, last, fusion::front(dest));
        }

-        template <typename Iterator>
+        template <typename Iterator, typename Dest>
        inline void
-        move_to(Iterator first, Iterator last,
boost::iterator_range<Iterator>&
rng, range_attribute)
+        move_to(Iterator first, Iterator last, Dest& dest,
range_attribute)
        {
-            rng = {first, last};
+            dest = {first, last};
        }
    }


This would allow anyone to use the `raw[]` directive with types such as
std::string_view and std::span by simply specializing is_range.

--000000000000d9130205c3a3c6ba
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Currently, <font face=3D"monospace">traits</font> speciali=
zes <font face=3D"monospace">move_to</font> only for <font face=3D"monospac=
e">boost::iterator_range</font>. This leaves all the other potential ranges=
 out. I wonder why it&#39;s not more generically specified for ranges as it=
 is for containers. I.e.:<div><br></div><blockquote style=3D"margin:0 0 0 4=
0px;border:none;padding:0px"><div><span style=3D"font-family:monospace"><sp=
an style=3D"color:rgb(0,0,0)">--- boost_1_76_0/boost/spirit/home/x3/support=
/traits/move_to.hpp =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A02021-04-</spa=
n></span></div><div><span style=3D"font-family:monospace">13 09:23:01.00000=
0000 -0700
</span></div><div><span style=3D"font-family:monospace">+++ boost_mine/boos=
t/spirit/home/x3/support/traits/move_to.hpp =C2=A02021-05-31 10:34</span></=
div><div><span style=3D"font-family:monospace">:21.950810803 -0700
</span></div><div><span style=3D"font-family:monospace">@@ -182,11 +182,11 =
@@
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0traits::move_to(first=
, last, fusion::front(dest));
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0}
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span></div><div><span style=3D"font-f=
amily:monospace">- =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0template &lt;t=
ypename Iterator&gt;
</span></div><div><span style=3D"font-family:monospace">+ =C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0template &lt;typename Iterator, typename Dest&gt=
;
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0inline void
</span></div><div><span style=3D"font-family:monospace">- =C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0move_to(Iterator first, Iterator last, boost::it=
erator_range&lt;Iterator&gt;&amp;</span></div><div><span style=3D"font-fami=
ly:monospace"> rng, range_attribute)
</span></div><div><span style=3D"font-family:monospace">+ =C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0move_to(Iterator first, Iterator last, Dest&amp;=
 dest, range_attribute)
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0{
</span></div><div><span style=3D"font-family:monospace">- =C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0rng =3D {first, last};
</span></div><div><span style=3D"font-family:monospace">+ =C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dest =3D {first, last};
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0}
</span></div><div><span style=3D"font-family:monospace"> =C2=A0=C2=A0=C2=A0=
=C2=A0}
</span></div></blockquote><div><br><font face=3D"arial, sans-serif">This wo=
uld allow anyone to use the `raw[]` directive with types such as std::strin=
g_view and std::span by simply specializing is_range.<br></font></div></div=
>

--000000000000d9130205c3a3c6ba--


--===============0257131171138728644==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============0257131171138728644==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general

--===============0257131171138728644==--