<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [RFE] add constexpr to some bitset functions"
   href="http://llvm.org/bugs/show_bug.cgi?id=16770">16770</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[RFE] add constexpr to some bitset functions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>hhinnant@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>1zeeky@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10972" name="attach_10972" title="diff against my bitset header with constexpr additions">attachment 10972</a> <a href="attachment.cgi?id=10972&action=edit" title="diff against my bitset header with constexpr additions">[details]</a></span>
diff against my bitset header with constexpr additions

I would like constexpr versions of the following functions in std::bitset:
to_ulong, to_ullong

I wrote a patch.
Because it looked easy, I also converted all(), any(), none() and test() to
constexpr.
There are overloads for all(), any() and to_ullong to write the loops via
recursive function-calls. An additional overload for any() is used in the
exception-version of to_ul(l)ong.
I'm certain a couple of more could be converted to constexpr, like flip() and
the operators == and != (the latter two might even be useful as constexpr), but
I am currently not interested in those.

I am unable to execute the tests: I'm getting a Python exception about not
being able to find the __main__ module. As such, I only did a very rudimentary
test of the patch.
Further more, I might have violated (probably did) coding conventions and I
probably broke ABI compatibility (I have no experience with that).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>