This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for constexpr variable templates


How difficult would it be to make partial specializations work:

// Write n*pi once for every possible type
template<typename Tp, std::size_t N>
  constexpr Tp npi = N * Tp(3.1415926535897932385L);

// Partial specialization for int type.
template<std::size_t N>
  constexpr double npi<int, N> = N * double(3.1415926535897932385L);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]