Note that there are some explanatory texts on larger screens.

plurals
  1. POFiltering specific iterators for template functions
    text
    copied!<p>I am developing a set of functions that takes advantage of containers that have packed and sequential memory storage (for memory copies). They have function signatures in the style of most STD functions, input/output iterators point to elements and denote ranges. For instance, a function could look like this:</p> <pre><code>template&lt; typename InputIterator, typename OutputIterator &gt; OutputIterator fooBar( InputIterator&amp; first, InputIterator&amp; last, OutputIterator&amp; result ); </code></pre> <p>I wish to verify that the iterators passed are legal, that is packed and sequential. For the STD containers, this is limited to std::vector and std::array. Unfortunately, I can't rely on the iterator 'category' trait, because the random access trait does not imply seqential storage. An example of this is microsofts concurrent_vector class, documented here <a href="http://msdn.microsoft.com/en-us/library/dd504906%28v=vs.110%29.aspx" rel="nofollow">parallel containers</a></p> <p>In addition, I can't accept all iterators from the vector and array classes either, for instance i need to reject reverse iterators, and std::vector<code>&lt;bool</code>> iterators are unsuitable because of the proxy class that it uses. </p> <p>I've attempted to create my own traits class to distinguish and filter the iterators with the constraints that i describe above, but i'm running into template syntax problems. I am looking for feedback from others on how they would approach this problem.</p> <p>Thanks</p>
 

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