Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • I also must admit, that this will not work with older c++ compilers... Commented Oct 1, 2009 at 22:32
  • 2
    But its still pretty awesome solution :) Commented Oct 1, 2009 at 22:45
  • +1 for awesome metaprogramming, but -1 because it still linear in P. Commented Oct 5, 2012 at 14:49
  • A newb question: why is the result an enum and not some integer type explicitly? Commented Feb 19, 2013 at 15:33
  • 1
    When P>1, compiler stops with specialization P=1. Similarly P=0 is there to cover Pow<X,0>. Needs a static_assert (P >= 0, "Only non-negative P can be input"). Commented Dec 31, 2017 at 20:16