Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My personal approach to this sort of things is to use <em>property maps</em>: I <a href="https://github.com/dietmarkuehl/kuhllib/wiki/STL-2.0" rel="nofollow">envision a system</a> of algorithms which can [optionally] take a property map (or actually sometimes multiple property maps) for each range. The idea is that <code>*it</code> yields a <em>key</em> (e.g., the <code>T&amp;</code> it currently do) which is then used with a property map which transforms the key into the actually accessed <em>value</em>. The transformation can, e.g., be the identity yielding the current behavior of the algorithms and a good default to be used when there is no property map. The example above would look something like this:</p> <pre><code>auto const cursor = c.begin(); std::printf("%c\n", c.map_source()(*cursor)); std::printf("%c\n", c.map_upper()(*cursor)); c.map_source()(*cursor, 'x'); std::copy(c.map_source(), c, std::ostreambuf_iterator&lt;char&gt;(std::cout)); std::copy(c.map_upper(), c, std::ostreambuf_iterator&lt;char&gt;(std::cout)); std::copy([](unsigned char c)-&gt;char{ return std::toupper(c); }, c, std::ostreambuf_iterator&lt;char&gt;(std::cout)); </code></pre> <p>The code assumes that the property maps yielding the source and the capitalized characters are obtained using <code>c.map_source()</code> and <code>c.map_upper()</code>, respectively. The last variant using <code>std::copy()</code> uses a lambda function as a property map.</p> <p>Sadly, I still haven't found the time to write up a coherent proposal to apply various improvements to the STL algorithms. ... nor do I have have an implementation putting it all together (I have a <a href="http://www.dietmar-kuehl.de/cxxrt/" rel="nofollow">somewhat clunky implementation</a> which is about 10 years old and doesn't benefit from various C++11 features which make it a lot easier; also, this implementation only concentrates on property maps and doesn't use the interface I currently envision).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload