Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not clear with which part of the problem you are stuck, so here is a starter for you.</p> <p>To get the parts of the strings between "given string" and the final '/' (where present):</p> <pre><code>std::string get_pertinent_part(const std::string&amp; s) { std::string::size_type first = 0; if (s.find(given_string) == 0) { first = given_string.length() + 1; } std::string::size_type count = std::string::npos; std::string::size_type pos = s.find_last_of("/"); if (pos != std::string::npos &amp;&amp; pos &gt; first) { count = pos + 1 - first; } return s.substr(first, count); } </code></pre> <p>To insert these parts into a new set (<code>output</code>) to guarantee uniqueness you can use the following:</p> <pre><code>std::transform(your_set.begin(), your_set.end(), std::inserter(output, output.end()), get_pertinent_part); </code></pre> <p>You may wish to pass <code>given_string</code> into <code>get_pertinent_part()</code>, in which case you'll need to convert it to a functor:</p> <pre><code>struct get_pertinent_part { const std::string given_string; get_pertinent_part(const std::string&amp; s) :given_string(s) { } std::string operator()(const std::string&amp; s) { std::string::size_type first = 0; // // ...same code as before... // return s.substr(first, count); } }; </code></pre> <p>You can then call it this way:</p> <pre><code>std::transform(your_set.begin(), your_set.end(), std::inserter(output, output.end()), get_pertinent_part("bin/obj/Debug")); </code></pre> <p>To output the new <code>set</code>:</p> <pre><code>std::copy(output.begin(), output.end(), std::ostream_iterator&lt;std::string&gt;(std::cout, "\n")); </code></pre> <p>Sorting the results is left as an exercise.</p>
    singulars
    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