From 7efcf9ccff318bbd8d2b69f308094ccfde094a70 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 21 Jan 2010 18:01:53 +0000 Subject: [PATCH] Set length of primes inside template on Sun C++. Refs #3854 [SVN r59200] --- include/boost/unordered/detail/util.hpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/include/boost/unordered/detail/util.hpp b/include/boost/unordered/detail/util.hpp index 22b41583..55409651 100644 --- a/include/boost/unordered/detail/util.hpp +++ b/include/boost/unordered/detail/util.hpp @@ -32,12 +32,6 @@ namespace boost { namespace unordered_detail { //////////////////////////////////////////////////////////////////////////// // primes - template struct prime_list_template - { - static std::size_t const value[]; - static std::ptrdiff_t const length; - }; - #define BOOST_UNORDERED_PRIMES \ (5ul)(11ul)(17ul)(29ul)(37ul)(53ul)(67ul)(79ul) \ (97ul)(131ul)(193ul)(257ul)(389ul)(521ul)(769ul) \ @@ -47,14 +41,28 @@ namespace boost { namespace unordered_detail { (50331653ul)(100663319ul)(201326611ul)(402653189ul)(805306457ul) \ (1610612741ul)(3221225473ul)(4294967291ul) + template struct prime_list_template + { + static std::size_t const value[]; + +#if !defined(SUNPRO_CC) + static std::ptrdiff_t const length; +#else + static std::ptrdiff_t const length + = BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES); +#endif + }; + template std::size_t const prime_list_template::value[] = { BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES) }; +#if !defined(SUNPRO_CC) template std::ptrdiff_t const prime_list_template::length = BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES); +#endif #undef BOOST_UNORDERED_PRIMES