code:
/*
 *
 * Copyright (c) 2004
 * John Maddock
 *
 * Use, modification and distribution are subject to the
 * Boost Software License, Version 1.0. (See accompanying file
 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 *
 */

 /*
  *   LOCATION:    see http://www.boost.org for most recent version.
  *   FILE         w32_regex_traits.hpp
  *   VERSION      see <boost/version.hpp>
  *   DESCRIPTION: Declares regular expression traits class w32_regex_traits.
  */

#ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
#define BOOST_W32_REGEX_TRAITS_HPP_INCLUDED

#ifndef BOOST_REGEX_NO_WIN32_LOCALE

#ifndef BOOST_RE_PAT_EXCEPT_HPP
#include <boost/regex/pattern_except.hpp>
#endif
#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
#include <boost/regex/v4/regex_traits_defaults.hpp>
#endif
#ifdef BOOST_HAS_THREADS
#include <boost/regex/pending/static_mutex.hpp>
#endif
#ifndef BOOST_REGEX_PRIMARY_TRANSFORM
#include <boost/regex/v4/primary_transform.hpp>
#endif
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
#include <boost/regex/pending/object_cache.hpp>
#endif

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
#  include BOOST_ABI_PREFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4786)
#pragma warning(disable:4800)
#endif

namespace boost{

//
// forward declaration is needed by some compilers:
//
template <class charT>
class w32_regex_traits;

namespace BOOST_REGEX_DETAIL_NS{

//
// start by typedeffing the types we'll need:
//
typedef ::boost::uint32_t lcid_type;   // placeholder for LCID.
typedef ::boost::shared_ptr<void> cat_type; // placeholder for dll HANDLE.

//
// then add wrappers around the actual Win32 API's (ie implementation hiding):
//
BOOST_REGEX_DECL lcid_type BOOST_REGEX_CALL w32_get_default_locale();
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char, lcid_type);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t, lcid_type);
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type state_id);
#endif
#endif
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char, lcid_type);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t, lcid_type);
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type state_id);
#endif
#endif
BOOST_REGEX_DECL cat_type BOOST_REGEX_CALL w32_cat_open(const std::string& name);
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type state_id, int i, const std::string& def);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type state_id, int i, const std::wstring& def);
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::basic_string<unsigned short>& def);
#endif
#endif
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type state_id, const char* p1, const char* p2);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type state_id, const wchar_t* p1, const wchar_t* p2);
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type state_id, const unsigned short* p1, const unsigned short* p2);
#endif
#endif
BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type);
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type state_id);
#endif
#endif
BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type);
#endif
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type, boost::uint32_t mask, char c);
#ifndef BOOST_NO_WREGEX
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type, boost::uint32_t mask, wchar_t c);
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type state_id, boost::uint32_t m, unsigned short c);
#endif
#endif
//
// class w32_regex_traits_base:
// acts as a container for locale and the facets we are using.
//
template <class charT>
struct w32_regex_traits_base
{
   w32_regex_traits_base(lcid_type l)
   { imbue(l); }
   lcid_type imbue(lcid_type l);

   lcid_type m_locale;
};

template <class charT>
inline lcid_type w32_regex_traits_base<charT>::imbue(lcid_type l)
{
   lcid_type result(m_locale);
   m_locale = l;
   return result;
}

//
// class w32_regex_traits_char_layer:
// implements methods that require specialisation for narrow characters:
//
template <class charT>
class w32_regex_traits_char_layer : public w32_regex_traits_base<charT>
{
   typedef std::basic_string<charT> string_type;
   typedef std::map<charT, regex_constants::syntax_type> map_type;
   typedef typename map_type::const_iterator map_iterator_type;
public:
   w32_regex_traits_char_layer(const lcid_type l);

   regex_constants::syntax_type syntax_type(charT c)const
   {
      map_iterator_type i = m_char_map.find(c);
      return ((i == m_char_map.end()) ? 0 : i->second);
   }
   regex_constants::escape_syntax_type escape_syntax_type(charT c) const
   {
      map_iterator_type i = m_char_map.find(c);
      if(i == m_char_map.end())
      {
         if(::boost::BOOST_REGEX_DETAIL_NS::w32_is_lower(c, this->m_locale)) return regex_constants::escape_type_class;
         if(::boost::BOOST_REGEX_DETAIL_NS::w32_is_upper(c, this->m_locale)) return regex_constants::escape_type_not_class;
         return 0;
      }
      return i->second;
   }
   charT tolower(charT c)const
   {
      return ::boost::BOOST_REGEX_DETAIL_NS::w32_tolower(c, this->m_locale);
   }
   bool isctype(boost::uint32_t mask, charT c)const
   {
      return ::boost::BOOST_REGEX_DETAIL_NS::w32_is(this->m_locale, mask, c);
   }

private:
   string_type get_default_message(regex_constants::syntax_type);
   // TODO: use a hash table when available!
   map_type m_char_map;
};

template <class charT>
w32_regex_traits_char_layer<charT>::w32_regex_traits_char_layer(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l)
   : w32_regex_traits_base<charT>(l)
{
   // we need to start by initialising our syntax map so we know which
   // character is used for which purpose:
   cat_type cat;
   std::string cat_name(w32_regex_traits<charT>::get_catalog_name());
   if(cat_name.size())
   {
      cat = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_open(cat_name);
      if(!cat)
      {
         std::string m("Unable to open message catalog: ");
         std::runtime_error err(m + cat_name);
         boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
      }
   }
   //
   // if we have a valid catalog then load our messages:
   //
   if(cat)
   {
      for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
      {
         string_type mss = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, i, get_default_message(i));
         for(typename string_type::size_type j = 0; j < mss.size(); ++j)
         {
            this->m_char_map[mss[j]] = i;
         }
      }
   }
   else
   {
      for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
      {
         const char* ptr = get_default_syntax(i);
         while(ptr && *ptr)
         {
            this->m_char_map[static_cast<charT>(*ptr)] = i;
            ++ptr;
         }
      }
   }
}

template <class charT>
typename w32_regex_traits_char_layer<charT>::string_type
   w32_regex_traits_char_layer<charT>::get_default_message(regex_constants::syntax_type i)
{
   const char* ptr = get_default_syntax(i);
   string_type result;
   while(ptr && *ptr)
   {
      result.append(1, static_cast<charT>(*ptr));
      ++ptr;
   }
   return result;
}

//
// specialised version for narrow characters:
//
template <>
class BOOST_REGEX_DECL w32_regex_traits_char_layer<char> : public w32_regex_traits_base<char>
{
   typedef std::string string_type;
public:
   w32_regex_traits_char_layer(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l)
   : w32_regex_traits_base<char>(l)
   {
      init();
   }

   regex_constants::syntax_type syntax_type(char c)const
   {
      return m_char_map[static_cast<unsigned char>(c)];
   }
   regex_constants::escape_syntax_type escape_syntax_type(char c) const
   {
      return m_char_map[static_cast<unsigned char>(c)];
   }
   char tolower(char c)const
   {
      return m_lower_map[static_cast<unsigned char>(c)];
   }
   bool isctype(boost::uint32_t mask, char c)const
   {
      return m_type_map[static_cast<unsigned char>(c)] & mask;
   }

private:
   regex_constants::syntax_type m_char_map[1u << CHAR_BIT];
   char m_lower_map[1u << CHAR_BIT];
   boost::uint16_t m_type_map[1u << CHAR_BIT];
   void init();
};

//
// class w32_regex_traits_implementation:
// provides pimpl implementation for w32_regex_traits.
//
template <class charT>
class w32_regex_traits_implementation : public w32_regex_traits_char_layer<charT>
{
public:
   typedef typename w32_regex_traits<charT>::char_class_type char_class_type;
   BOOST_STATIC_CONSTANT(char_class_type, mask_word = 0x0400); // must be C1_DEFINED << 1
   BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 0x0800); // must be C1_DEFINED << 2
   BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 0x1000); // must be C1_DEFINED << 3
   BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 0x2000); // must be C1_DEFINED << 4
   BOOST_STATIC_CONSTANT(char_class_type, mask_base = 0x3ff);  // all the masks used by the CT_CTYPE1 group

   typedef std::basic_string<charT> string_type;
   typedef charT char_type;
   w32_regex_traits_implementation(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l);
   std::string error_string(regex_constants::error_type n) const
   {
      if(!m_error_strings.empty())
      {
         std::map<int, std::string>::const_iterator p = m_error_strings.find(n);
         return (p == m_error_strings.end()) ? std::string(get_default_error_string(n)) : p->second;
      }
      return get_default_error_string(n);
   }
   char_class_type lookup_classname(const charT* p1, const charT* p2) const
   {
      char_class_type result = lookup_classname_imp(p1, p2);
      if(result == 0)
      {
         typedef typename string_type::size_type size_type;
         string_type temp(p1, p2);
         for(size_type i = 0; i < temp.size(); ++i)
            temp[i] = this->tolower(temp[i]);
         result = lookup_classname_imp(&*temp.begin(), &*temp.begin() + temp.size());
      }
      return result;
   }
   string_type lookup_collatename(const charT* p1, const charT* p2) const;
   string_type transform_primary(const charT* p1, const charT* p2) const;
   string_type transform(const charT* p1, const charT* p2) const
   {
      return ::boost::BOOST_REGEX_DETAIL_NS::w32_transform(this->m_locale, p1, p2);
   }
private:
   std::map<int, std::string>     m_error_strings;   // error messages indexed by numberic ID
   std::map<string_type, char_class_type>  m_custom_class_names; // character class names
   std::map<string_type, string_type>      m_custom_collate_names; // collating element names
   unsigned                       m_collate_type;    // the form of the collation string
   charT                          m_collate_delim;   // the collation group delimiter
   //
   // helpers:
   //
   char_class_type lookup_classname_imp(const charT* p1, const charT* p2) const;
};

template <class charT>
typename w32_regex_traits_implementation<charT>::string_type
   w32_regex_traits_implementation<charT>::transform_primary(const charT* p1, const charT* p2) const
{
   string_type result;
   //
   // What we do here depends upon the format of the sort key returned by
   // sort key returned by this->transform:
   //
   switch(m_collate_type)
   {
   case sort_C:
   case sort_unknown:
      // the best we can do is translate to lower case, then get a regular sort key:
      {
         result.assign(p1, p2);
         typedef typename string_type::size_type size_type;
         for(size_type i = 0; i < result.size(); ++i)
            result[i] = this->tolower(result[i]);
         result = this->transform(&*result.begin(), &*result.begin() + result.size());
         break;
      }
   case sort_fixed:
      {
         // get a regular sort key, and then truncate it:
         result.assign(this->transform(p1, p2));
         result.erase(this->m_collate_delim);
         break;
      }
   case sort_delim:
         // get a regular sort key, and then truncate everything after the delim:
         result.assign(this->transform(p1, p2));
         std::size_t i;
         for(i = 0; i < result.size(); ++i)
         {
            if(result[i] == m_collate_delim)
               break;
         }
         result.erase(i);
         break;
   }
   if(result.empty())
      result = string_type(1, charT(0));
   return result;
}

template <class charT>
typename w32_regex_traits_implementation<charT>::string_type
   w32_regex_traits_implementation<charT>::lookup_collatename(const charT* p1, const charT* p2) const
{
   typedef typename std::map<string_type, string_type>::const_iterator iter_type;
   if(m_custom_collate_names.size())
   {
      iter_type pos = m_custom_collate_names.find(string_type(p1, p2));
      if(pos != m_custom_collate_names.end())
         return pos->second;
   }
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
               && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
   std::string name(p1, p2);
#else
   std::string name;
   const charT* p0 = p1;
   while(p0 != p2)
      name.append(1, char(*p0++));
#endif
   name = lookup_default_collate_name(name);
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
               && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
   if(name.size())
      return string_type(name.begin(), name.end());
#else
   if(name.size())
   {
      string_type result;
      typedef std::string::const_iterator iter;
      iter b = name.begin();
      iter e = name.end();
      while(b != e)
         result.append(1, charT(*b++));
      return result;
   }
#endif
   if(p2 - p1 == 1)
      return string_type(1, *p1);
   return string_type();
}

template <class charT>
w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l)
: w32_regex_traits_char_layer<charT>(l)
{
   cat_type cat;
   std::string cat_name(w32_regex_traits<charT>::get_catalog_name());
   if(cat_name.size())
   {
      cat = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_open(cat_name);
      if(!cat)
      {
         std::string m("Unable to open message catalog: ");
         std::runtime_error err(m + cat_name);
         boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(err);
      }
   }
   //
   // if we have a valid catalog then load our messages:
   //
   if(cat)
   {
      //
      // Error messages:
      //
      for(boost::regex_constants::error_type i = static_cast<boost::regex_constants::error_type>(0);
         i <= boost::regex_constants::error_unknown;
         i = static_cast<boost::regex_constants::error_type>(i + 1))
      {
         const char* p = get_default_error_string(i);
         string_type default_message;
         while(*p)
         {
            default_message.append(1, static_cast<charT>(*p));
            ++p;
         }
         string_type s = ::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, i+200, default_message);
         std::string result;
         for(std::string::size_type j = 0; j < s.size(); ++j)
         {
            result.append(1, static_cast<char>(s[j]));
         }
         m_error_strings[i] = result;
      }
      //
      // Custom class names:
      //
      static const char_class_type masks[14] =
      {
         0x0104u, // C1_ALPHA | C1_DIGIT
         0x0100u, // C1_ALPHA
         0x0020u, // C1_CNTRL
         0x0004u, // C1_DIGIT
         (~(0x0020u|0x0008u) & 0x01ffu) | 0x0400u, // not C1_CNTRL or C1_SPACE
         0x0002u, // C1_LOWER
         (~0x0020u & 0x01ffu) | 0x0400, // not C1_CNTRL
         0x0010u, // C1_PUNCT
         0x0008u, // C1_SPACE
         0x0001u, // C1_UPPER
         0x0080u, // C1_XDIGIT
         0x0040u, // C1_BLANK
         w32_regex_traits_implementation<charT>::mask_word,
         w32_regex_traits_implementation<charT>::mask_unicode,
      };
      static const string_type null_string;
      for(unsigned int j = 0; j <= 13; ++j)
      {
         string_type s(::boost::BOOST_REGEX_DETAIL_NS::w32_cat_get(cat, this->m_locale, j+300, null_string));
         if(s.size())
            this->m_custom_class_names[s] = masks[j];
      }
   }
   //
   // get the collation format used by m_pcollate:
   //
   m_collate_type = BOOST_REGEX_DETAIL_NS::find_sort_syntax(this, &m_collate_delim);
}

template <class charT>
typename w32_regex_traits_implementation<charT>::char_class_type
   w32_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
{
   static const char_class_type masks[22] =
   {
      0,
      0x0104u, // C1_ALPHA | C1_DIGIT
      0x0100u, // C1_ALPHA
      0x0040u, // C1_BLANK
      0x0020u, // C1_CNTRL
      0x0004u, // C1_DIGIT
      0x0004u, // C1_DIGIT
      (~(0x0020u|0x0008u|0x0040) & 0x01ffu) | 0x0400u, // not C1_CNTRL or C1_SPACE or C1_BLANK
      w32_regex_traits_implementation<charT>::mask_horizontal,
      0x0002u, // C1_LOWER
      0x0002u, // C1_LOWER
      (~0x0020u & 0x01ffu) | 0x0400, // not C1_CNTRL
      0x0010u, // C1_PUNCT
      0x0008u, // C1_SPACE
      0x0008u, // C1_SPACE
      0x0001u, // C1_UPPER
      w32_regex_traits_implementation<charT>::mask_unicode,
      0x0001u, // C1_UPPER
      w32_regex_traits_implementation<charT>::mask_vertical,
      0x0104u | w32_regex_traits_implementation<charT>::mask_word,
      0x0104u | w32_regex_traits_implementation<charT>::mask_word,
      0x0080u, // C1_XDIGIT
   };
   if(m_custom_class_names.size())
   {
      typedef typename std::map<std::basic_string<charT>, char_class_type>::const_iterator map_iter;
      map_iter pos = m_custom_class_names.find(string_type(p1, p2));
      if(pos != m_custom_class_names.end())
         return pos->second;
   }
   std::size_t state_id = 1 + BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2);
   if(state_id < sizeof(masks) / sizeof(masks[0]))
      return masks[state_id];
   return masks[0];
}

template <class charT>
boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l)
{
   // TODO: create a cache for previously constructed objects.
   return boost::object_cache< ::boost::BOOST_REGEX_DETAIL_NS::lcid_type, w32_regex_traits_implementation<charT> >::get(l, 5);
}

} // BOOST_REGEX_DETAIL_NS

template <class charT>
class w32_regex_traits
{
public:
   typedef charT                         char_type;
   typedef std::size_t                   size_type;
   typedef std::basic_string<char_type>  string_type;
   typedef ::boost::BOOST_REGEX_DETAIL_NS::lcid_type locale_type;
   typedef boost::uint_least32_t         char_class_type;

   struct boost_extensions_tag{};

   w32_regex_traits()
      : m_pimpl(BOOST_REGEX_DETAIL_NS::create_w32_regex_traits<charT>(::boost::BOOST_REGEX_DETAIL_NS::w32_get_default_locale()))
   { }
   static size_type length(const char_type* p)
   {
      return std::char_traits<charT>::length(p);
   }
   regex_constants::syntax_type syntax_type(charT c)const
   {
      return m_pimpl->syntax_type(c);
   }
   regex_constants::escape_syntax_type escape_syntax_type(charT c) const
   {
      return m_pimpl->escape_syntax_type(c);
   }
   charT translate(charT c) const
   {
      return c;
   }
   charT translate_nocase(charT c) const
   {
      return this->m_pimpl->tolower(c);
   }
   charT translate(charT c, bool icase) const
   {
      return icase ? this->m_pimpl->tolower(c) : c;
   }
   charT tolower(charT c) const
   {
      return this->m_pimpl->tolower(c);
   }
   charT toupper(charT c) const
   {
      return ::boost::BOOST_REGEX_DETAIL_NS::w32_toupper(c, this->m_pimpl->m_locale);
   }
   string_type transform(const charT* p1, const charT* p2) const
   {
      return ::boost::BOOST_REGEX_DETAIL_NS::w32_transform(this->m_pimpl->m_locale, p1, p2);
   }
   string_type transform_primary(const charT* p1, const charT* p2) const
   {
      return m_pimpl->transform_primary(p1, p2);
   }
   char_class_type lookup_classname(const charT* p1, const charT* p2) const
   {
      return m_pimpl->lookup_classname(p1, p2);
   }
   string_type lookup_collatename(const charT* p1, const charT* p2) const
   {
      return m_pimpl->lookup_collatename(p1, p2);
   }
   bool isctype(charT c, char_class_type f) const
   {
      if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_base)
         && (this->m_pimpl->isctype(f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_base, c)))
         return true;
      else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_unicode) && BOOST_REGEX_DETAIL_NS::is_extended(c))
         return true;
      else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_word) && (c == '_'))
         return true;
      else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_vertical)
         && (::boost::BOOST_REGEX_DETAIL_NS::is_separator(c) || (c == '\v')))
         return true;
      else if((f & BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_horizontal)
         && this->isctype(c, 0x0008u) && !this->isctype(c, BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT>::mask_vertical))
         return true;
      return false;
   }
   boost::intmax_t toi(const charT*& p1, const charT* p2, int radix)const
   {
      return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
   }
   int value(charT c, int radix)const
   {
      int result = (int)::boost::BOOST_REGEX_DETAIL_NS::global_value(c);
      return result < radix ? result : -1;
   }
   locale_type imbue(locale_type l)
   {
      ::boost::BOOST_REGEX_DETAIL_NS::lcid_type result(getloc());
      m_pimpl = BOOST_REGEX_DETAIL_NS::create_w32_regex_traits<charT>(l);
      return result;
   }
   locale_type getloc()const
   {
      return m_pimpl->m_locale;
   }
   std::string error_string(regex_constants::error_type n) const
   {
      return m_pimpl->error_string(n);
   }

   //
   // extension:
   // set the name of the message catalog in use (defaults to "boost_regex").
   //
   static std::string catalog_name(const std::string& name);
   static std::string get_catalog_name();

private:
   boost::shared_ptr<const BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT> > m_pimpl;
   //
   // catalog name handler:
   //
   static std::string& get_catalog_name_inst();

#ifdef BOOST_HAS_THREADS
   static static_mutex& get_mutex_inst();
#endif
};

template <class charT>
std::string w32_regex_traits<charT>::catalog_name(const std::string& name)
{
#ifdef BOOST_HAS_THREADS
   static_mutex::scoped_lock lk(get_mutex_inst());
#endif
   std::string result(get_catalog_name_inst());
   get_catalog_name_inst() = name;
   return result;
}

template <class charT>
std::string& w32_regex_traits<charT>::get_catalog_name_inst()
{
   static std::string s_name;
   return s_name;
}

template <class charT>
std::string w32_regex_traits<charT>::get_catalog_name()
{
#ifdef BOOST_HAS_THREADS
   static_mutex::scoped_lock lk(get_mutex_inst());
#endif
   std::string result(get_catalog_name_inst());
   return result;
}

#ifdef BOOST_HAS_THREADS
template <class charT>
static_mutex& w32_regex_traits<charT>::get_mutex_inst()
{
   static static_mutex s_mutex = BOOST_STATIC_MUTEX_INIT;
   return s_mutex;
}
#endif

} // boost

#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
#  include BOOST_ABI_SUFFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

#endif // BOOST_REGEX_NO_WIN32_LOCALE

#endif


code:
#ifndef BOOST_MPL_VECTOR_AUX_O1_SIZE_HPP_INCLUDED
#define BOOST_MPL_VECTOR_AUX_O1_SIZE_HPP_INCLUDED

// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.

// $Id$
// $Date$
// $Revision$

#include <boost/mpl/O1_size_fwd.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/long.hpp>
#include <boost/mpl/vector/aux_/tag.hpp>
#include <boost/mpl/aux_/config/typeof.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>

namespace boost { namespace mpl {

#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)

template<>
struct O1_size_impl< aux::vector_tag >
{
    template< typename Vector > struct apply
        : Vector::size
    {
    };
};

#else

#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)

template< long N >
struct O1_size_impl< aux::vector_tag<N> >
{
    template< typename Vector > struct apply
        : mpl::long_<N>
    {
    };
};

#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES

}}

#endif // BOOST_MPL_VECTOR_AUX_O1_SIZE_HPP_INCLUDED

license: mit


code:
///////////////////////////////////////////////////////////////////////////////
//  Copyright 2013 John Maddock. Distributed under the Boost
//  Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_MP_UBLAS_HPP
#define BOOST_MP_UBLAS_HPP

namespace boost { namespace numeric { namespace ublas {

template<class V>
class sparse_vector_element;

template <class V, class Backend, multiprecision::expression_template_option ExpressionTemplates>
inline bool operator == (const sparse_vector_element<V>& a, const ::boost::multiprecision::number<Backend, ExpressionTemplates>& b)
{
   typedef typename sparse_vector_element<V>::const_reference ref_type;
   return static_cast<ref_type>(a) == b;
}

template<class X, class Y>
struct promote_traits;

template <class Backend1, boost::multiprecision::expression_template_option ExpressionTemplates1, class Backend2, boost::multiprecision::expression_template_option ExpressionTemplates2>
struct promote_traits<boost::multiprecision::number<Backend1, ExpressionTemplates1>, boost::multiprecision::number<Backend2, ExpressionTemplates2> >
{
   typedef boost::multiprecision::number<Backend1, ExpressionTemplates1> number1_t;
   typedef boost::multiprecision::number<Backend2, ExpressionTemplates2> number2_t;
   typedef typename mpl::if_c<
      is_convertible<number1_t, number2_t>::value && !is_convertible<number2_t, number1_t>::value,
      number2_t, number1_t
   >::type promote_type;
};

template <class Backend1, boost::multiprecision::expression_template_option ExpressionTemplates1, class Arithmetic>
struct promote_traits<boost::multiprecision::number<Backend1, ExpressionTemplates1>, Arithmetic>
{
   typedef boost::multiprecision::number<Backend1, ExpressionTemplates1> promote_type;
};

template <class Arithmetic, class Backend1, boost::multiprecision::expression_template_option ExpressionTemplates1>
struct promote_traits<Arithmetic, boost::multiprecision::number<Backend1, ExpressionTemplates1> >
{
   typedef boost::multiprecision::number<Backend1, ExpressionTemplates1> promote_type;
};

template <class Backend1, boost::multiprecision::expression_template_option ExpressionTemplates1, class tag, class Arg1, class Arg2, class Arg3, class Arg4>
struct promote_traits<boost::multiprecision::number<Backend1, ExpressionTemplates1>, boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> >
{
   typedef boost::multiprecision::number<Backend1, ExpressionTemplates1> number1_t;
   typedef boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> expression_type;
   typedef typename expression_type::result_type number2_t;
   typedef typename promote_traits<number1_t, number2_t>::promote_type promote_type;
};

template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class Backend1, boost::multiprecision::expression_template_option ExpressionTemplates1>
struct promote_traits<boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, boost::multiprecision::number<Backend1, ExpressionTemplates1> >
{
   typedef boost::multiprecision::number<Backend1, ExpressionTemplates1> number1_t;
   typedef boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> expression_type;
   typedef typename expression_type::result_type number2_t;
   typedef typename promote_traits<number1_t, number2_t>::promote_type promote_type;
};

template <class tag, class Arg1, class Arg2, class Arg3, class Arg4, class tagb, class Arg1b, class Arg2b, class Arg3b, class Arg4b>
struct promote_traits<boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>, boost::multiprecision::detail::expression<tagb, Arg1b, Arg2b, Arg3b, Arg4b> >
{
   typedef boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4> expression1_t;
   typedef typename expression1_t::result_type number1_t;
   typedef boost::multiprecision::detail::expression<tagb, Arg1b, Arg2b, Arg3b, Arg4b> expression2_t;
   typedef typename expression2_t::result_type number2_t;
};

}}} // namespace

#endif


code:
# /* **************************************************************************
#  *                                                                          *
#  *     (C) Copyright Paul Mensonides 2002.
#  *     Distributed under the Boost Software License, Version 1.0. (See
#  *     accompanying file LICENSE_1_0.txt or copy at
#  *     http://www.boost.org/LICENSE_1_0.txt)
#  *                                                                          *
#  ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_DETAIL_AUTO_REC_HPP
# define BOOST_PREPROCESSOR_DETAIL_AUTO_REC_HPP
#
# include <boost/preprocessor/control/iif.hpp>
#
# /* BOOST_PP_AUTO_REC */
#
# define BOOST_PP_AUTO_REC(pred, n) BOOST_PP_NODE_ENTRY_ ## n(pred)
#
# define BOOST_PP_NODE_ENTRY_256(p) BOOST_PP_NODE_128(p)(p)(p)(p)(p)(p)(p)(p)
# define BOOST_PP_NODE_ENTRY_128(p) BOOST_PP_NODE_64(p)(p)(p)(p)(p)(p)(p)
# define BOOST_PP_NODE_ENTRY_64(p) BOOST_PP_NODE_32(p)(p)(p)(p)(p)(p)
# define BOOST_PP_NODE_ENTRY_32(p) BOOST_PP_NODE_16(p)(p)(p)(p)(p)
# define BOOST_PP_NODE_ENTRY_16(p) BOOST_PP_NODE_8(p)(p)(p)(p)
# define BOOST_PP_NODE_ENTRY_8(p) BOOST_PP_NODE_4(p)(p)(p)
# define BOOST_PP_NODE_ENTRY_4(p) BOOST_PP_NODE_2(p)(p)
# define BOOST_PP_NODE_ENTRY_2(p) BOOST_PP_NODE_1(p)
#
# define BOOST_PP_NODE_128(p) BOOST_PP_IIF(p##(128), BOOST_PP_NODE_64, BOOST_PP_NODE_192)
#    define BOOST_PP_NODE_64(p) BOOST_PP_IIF(p##(64), BOOST_PP_NODE_32, BOOST_PP_NODE_96)
#        define BOOST_PP_NODE_32(p) BOOST_PP_IIF(p##(32), BOOST_PP_NODE_16, BOOST_PP_NODE_48)
#            define BOOST_PP_NODE_16(p) BOOST_PP_IIF(p##(16), BOOST_PP_NODE_8, BOOST_PP_NODE_24)
#                define BOOST_PP_NODE_8(p) BOOST_PP_IIF(p##(8), BOOST_PP_NODE_4, BOOST_PP_NODE_12)
#                    define BOOST_PP_NODE_4(p) BOOST_PP_IIF(p##(4), BOOST_PP_NODE_2, BOOST_PP_NODE_6)
#                        define BOOST_PP_NODE_2(p) BOOST_PP_IIF(p##(2), BOOST_PP_NODE_1, BOOST_PP_NODE_3)
#                            define BOOST_PP_NODE_1(p) BOOST_PP_IIF(p##(1), 1, 2)
#                            define BOOST_PP_NODE_3(p) BOOST_PP_IIF(p##(3), 3, 4)
#                        define BOOST_PP_NODE_6(p) BOOST_PP_IIF(p##(6), BOOST_PP_NODE_5, BOOST_PP_NODE_7)
#                            define BOOST_PP_NODE_5(p) BOOST_PP_IIF(p##(5), 5, 6)
#                            define BOOST_PP_NODE_7(p) BOOST_PP_IIF(p##(7), 7, 8)
#                    define BOOST_PP_NODE_12(p) BOOST_PP_IIF(p##(12), BOOST_PP_NODE_10, BOOST_PP_NODE_14)
#                        define BOOST_PP_NODE_10(p) BOOST_PP_IIF(p##(10), BOOST_PP_NODE_9, BOOST_PP_NODE_11)
#                            define BOOST_PP_NODE_9(p) BOOST_PP_IIF(p##(9), 9, 10)
#                            define BOOST_PP_NODE_11(p) BOOST_PP_IIF(p##(11), 11, 12)
#                        define BOOST_PP_NODE_14(p) BOOST_PP_IIF(p##(14), BOOST_PP_NODE_13, BOOST_PP_NODE_15)
#                            define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14)
#                            define BOOST_PP_NODE_15(p) BOOST_PP_IIF(p##(15), 15, 16)
#                define BOOST_PP_NODE_24(p) BOOST_PP_IIF(p##(24), BOOST_PP_NODE_20, BOOST_PP_NODE_28)
#                    define BOOST_PP_NODE_20(p) BOOST_PP_IIF(p##(20), BOOST_PP_NODE_18, BOOST_PP_NODE_22)
#                        define BOOST_PP_NODE_18(p) BOOST_PP_IIF(p##(18), BOOST_PP_NODE_17, BOOST_PP_NODE_19)
#                            define BOOST_PP_NODE_17(p) BOOST_PP_IIF(p##(17), 17, 18)
#                            define BOOST_PP_NODE_19(p) BOOST_PP_IIF(p##(19), 19, 20)
#                        define BOOST_PP_NODE_22(p) BOOST_PP_IIF(p##(22), BOOST_PP_NODE_21, BOOST_PP_NODE_23)
#                            define BOOST_PP_NODE_21(p) BOOST_PP_IIF(p##(21), 21, 22)
#                            define BOOST_PP_NODE_23(p) BOOST_PP_IIF(p##(23), 23, 24)
#                    define BOOST_PP_NODE_28(p) BOOST_PP_IIF(p##(28), BOOST_PP_NODE_26, BOOST_PP_NODE_30)
#                        define BOOST_PP_NODE_26(p) BOOST_PP_IIF(p##(26), BOOST_PP_NODE_25, BOOST_PP_NODE_27)
#                            define BOOST_PP_NODE_25(p) BOOST_PP_IIF(p##(25), 25, 26)
#                            define BOOST_PP_NODE_27(p) BOOST_PP_IIF(p##(27), 27, 28)
#                        define BOOST_PP_NODE_30(p) BOOST_PP_IIF(p##(30), BOOST_PP_NODE_29, BOOST_PP_NODE_31)
#                            define BOOST_PP_NODE_29(p) BOOST_PP_IIF(p##(29), 29, 30)
#                            define BOOST_PP_NODE_31(p) BOOST_PP_IIF(p##(31), 31, 32)
#            define BOOST_PP_NODE_48(p) BOOST_PP_IIF(p##(48), BOOST_PP_NODE_40, BOOST_PP_NODE_56)
#                define BOOST_PP_NODE_40(p) BOOST_PP_IIF(p##(40), BOOST_PP_NODE_36, BOOST_PP_NODE_44)
#                    define BOOST_PP_NODE_36(p) BOOST_PP_IIF(p##(36), BOOST_PP_NODE_34, BOOST_PP_NODE_38)
#                        define BOOST_PP_NODE_34(p) BOOST_PP_IIF(p##(34), BOOST_PP_NODE_33, BOOST_PP_NODE_35)
#                            define BOOST_PP_NODE_33(p) BOOST_PP_IIF(p##(33), 33, 34)
#                            define BOOST_PP_NODE_35(p) BOOST_PP_IIF(p##(35), 35, 36)
#                        define BOOST_PP_NODE_38(p) BOOST_PP_IIF(p##(38), BOOST_PP_NODE_37, BOOST_PP_NODE_39)
#                            define BOOST_PP_NODE_37(p) BOOST_PP_IIF(p##(37), 37, 38)
#                            define BOOST_PP_NODE_39(p) BOOST_PP_IIF(p##(39), 39, 40)
#                    define BOOST_PP_NODE_44(p) BOOST_PP_IIF(p##(44), BOOST_PP_NODE_42, BOOST_PP_NODE_46)
#                        define BOOST_PP_NODE_42(p) BOOST_PP_IIF(p##(42), BOOST_PP_NODE_41, BOOST_PP_NODE_43)
#                            define BOOST_PP_NODE_41(p) BOOST_PP_IIF(p##(41), 41, 42)
#                            define BOOST_PP_NODE_43(p) BOOST_PP_IIF(p##(43), 43, 44)
#                        define BOOST_PP_NODE_46(p) BOOST_PP_IIF(p##(46), BOOST_PP_NODE_45, BOOST_PP_NODE_47)
#                            define BOOST_PP_NODE_45(p) BOOST_PP_IIF(p##(45), 45, 46)
#                            define BOOST_PP_NODE_47(p) BOOST_PP_IIF(p##(47), 47, 48)
#                define BOOST_PP_NODE_56(p) BOOST_PP_IIF(p##(56), BOOST_PP_NODE_52, BOOST_PP_NODE_60)
#                    define BOOST_PP_NODE_52(p) BOOST_PP_IIF(p##(52), BOOST_PP_NODE_50, BOOST_PP_NODE_54)
#                        define BOOST_PP_NODE_50(p) BOOST_PP_IIF(p##(50), BOOST_PP_NODE_49, BOOST_PP_NODE_51)
#                            define BOOST_PP_NODE_49(p) BOOST_PP_IIF(p##(49), 49, 50)
#                            define BOOST_PP_NODE_51(p) BOOST_PP_IIF(p##(51), 51, 52)
#                        define BOOST_PP_NODE_54(p) BOOST_PP_IIF(p##(54), BOOST_PP_NODE_53, BOOST_PP_NODE_55)
#                            define BOOST_PP_NODE_53(p) BOOST_PP_IIF(p##(53), 53, 54)
#                            define BOOST_PP_NODE_55(p) BOOST_PP_IIF(p##(55), 55, 56)
#                    define BOOST_PP_NODE_60(p) BOOST_PP_IIF(p##(60), BOOST_PP_NODE_58, BOOST_PP_NODE_62)
#                        define BOOST_PP_NODE_58(p) BOOST_PP_IIF(p##(58), BOOST_PP_NODE_57, BOOST_PP_NODE_59)
#                            define BOOST_PP_NODE_57(p) BOOST_PP_IIF(p##(57), 57, 58)
#                            define BOOST_PP_NODE_59(p) BOOST_PP_IIF(p##(59), 59, 60)
#                        define BOOST_PP_NODE_62(p) BOOST_PP_IIF(p##(62), BOOST_PP_NODE_61, BOOST_PP_NODE_63)
#                            define BOOST_PP_NODE_61(p) BOOST_PP_IIF(p##(61), 61, 62)
#                            define BOOST_PP_NODE_63(p) BOOST_PP_IIF(p##(63), 63, 64)
#        define BOOST_PP_NODE_96(p) BOOST_PP_IIF(p##(96), BOOST_PP_NODE_80, BOOST_PP_NODE_112)
#            define BOOST_PP_NODE_80(p) BOOST_PP_IIF(p##(80), BOOST_PP_NODE_72, BOOST_PP_NODE_88)
#                define BOOST_PP_NODE_72(p) BOOST_PP_IIF(p##(72), BOOST_PP_NODE_68, BOOST_PP_NODE_76)
#                    define BOOST_PP_NODE_68(p) BOOST_PP_IIF(p##(68), BOOST_PP_NODE_66, BOOST_PP_NODE_70)
#                        define BOOST_PP_NODE_66(p) BOOST_PP_IIF(p##(66), BOOST_PP_NODE_65, BOOST_PP_NODE_67)
#                            define BOOST_PP_NODE_65(p) BOOST_PP_IIF(p##(65), 65, 66)
#                            define BOOST_PP_NODE_67(p) BOOST_PP_IIF(p##(67), 67, 68)
#                        define BOOST_PP_NODE_70(p) BOOST_PP_IIF(p##(70), BOOST_PP_NODE_69, BOOST_PP_NODE_71)
#                            define BOOST_PP_NODE_69(p) BOOST_PP_IIF(p##(69), 69, 70)
#                            define BOOST_PP_NODE_71(p) BOOST_PP_IIF(p##(71), 71, 72)
#                    define BOOST_PP_NODE_76(p) BOOST_PP_IIF(p##(76), BOOST_PP_NODE_74, BOOST_PP_NODE_78)
#                        define BOOST_PP_NODE_74(p) BOOST_PP_IIF(p##(74), BOOST_PP_NODE_73, BOOST_PP_NODE_75)
#                            define BOOST_PP_NODE_73(p) BOOST_PP_IIF(p##(73), 73, 74)
#                            define BOOST_PP_NODE_75(p) BOOST_PP_IIF(p##(75), 75, 76)
#                        define BOOST_PP_NODE_78(p) BOOST_PP_IIF(p##(78), BOOST_PP_NODE_77, BOOST_PP_NODE_79)
#                            define BOOST_PP_NODE_77(p) BOOST_PP_IIF(p##(77), 77, 78)
#                            define BOOST_PP_NODE_79(p) BOOST_PP_IIF(p##(79), 79, 80)
#                define BOOST_PP_NODE_88(p) BOOST_PP_IIF(p##(88), BOOST_PP_NODE_84, BOOST_PP_NODE_92)
#                    define BOOST_PP_NODE_84(p) BOOST_PP_IIF(p##(84), BOOST_PP_NODE_82, BOOST_PP_NODE_86)
#                        define BOOST_PP_NODE_82(p) BOOST_PP_IIF(p##(82), BOOST_PP_NODE_81, BOOST_PP_NODE_83)
#                            define BOOST_PP_NODE_81(p) BOOST_PP_IIF(p##(81), 81, 82)
#                            define BOOST_PP_NODE_83(p) BOOST_PP_IIF(p##(83), 83, 84)
#                        define BOOST_PP_NODE_86(p) BOOST_PP_IIF(p##(86), BOOST_PP_NODE_85, BOOST_PP_NODE_87)
#                            define BOOST_PP_NODE_85(p) BOOST_PP_IIF(p##(85), 85, 86)
#                            define BOOST_PP_NODE_87(p) BOOST_PP_IIF(p##(87), 87, 88)
#                    define BOOST_PP_NODE_92(p) BOOST_PP_IIF(p##(92), BOOST_PP_NODE_90, BOOST_PP_NODE_94)
#                        define BOOST_PP_NODE_90(p) BOOST_PP_IIF(p##(90), BOOST_PP_NODE_89, BOOST_PP_NODE_91)
#                            define BOOST_PP_NODE_89(p) BOOST_PP_IIF(p##(89), 89, 90)
#                            define BOOST_PP_NODE_91(p) BOOST_PP_IIF(p##(91), 91, 92)
#                        define BOOST_PP_NODE_94(p) BOOST_PP_IIF(p##(94), BOOST_PP_NODE_93, BOOST_PP_NODE_95)
#                            define BOOST_PP_NODE_93(p) BOOST_PP_IIF(p##(93), 93, 94)
#                            define BOOST_PP_NODE_95(p) BOOST_PP_IIF(p##(95), 95, 96)
#            define BOOST_PP_NODE_112(p) BOOST_PP_IIF(p##(112), BOOST_PP_NODE_104, BOOST_PP_NODE_120)
#                define BOOST_PP_NODE_104(p) BOOST_PP_IIF(p##(104), BOOST_PP_NODE_100, BOOST_PP_NODE_108)
#                    define BOOST_PP_NODE_100(p) BOOST_PP_IIF(p##(100), BOOST_PP_NODE_98, BOOST_PP_NODE_102)
#                        define BOOST_PP_NODE_98(p) BOOST_PP_IIF(p##(98), BOOST_PP_NODE_97, BOOST_PP_NODE_99)
#                            define BOOST_PP_NODE_97(p) BOOST_PP_IIF(p##(97), 97, 98)
#                            define BOOST_PP_NODE_99(p) BOOST_PP_IIF(p##(99), 99, 100)
#                        define BOOST_PP_NODE_102(p) BOOST_PP_IIF(p##(102), BOOST_PP_NODE_101, BOOST_PP_NODE_103)
#                            define BOOST_PP_NODE_101(p) BOOST_PP_IIF(p##(101), 101, 102)
#                            define BOOST_PP_NODE_103(p) BOOST_PP_IIF(p##(103), 103, 104)
#                    define BOOST_PP_NODE_108(p) BOOST_PP_IIF(p##(108), BOOST_PP_NODE_106, BOOST_PP_NODE_110)
#                        define BOOST_PP_NODE_106(p) BOOST_PP_IIF(p##(106), BOOST_PP_NODE_105, BOOST_PP_NODE_107)
#                            define BOOST_PP_NODE_105(p) BOOST_PP_IIF(p##(105), 105, 106)
#                            define BOOST_PP_NODE_107(p) BOOST_PP_IIF(p##(107), 107, 108)
#                        define BOOST_PP_NODE_110(p) BOOST_PP_IIF(p##(110), BOOST_PP_NODE_109, BOOST_PP_NODE_111)
#                            define BOOST_PP_NODE_109(p) BOOST_PP_IIF(p##(109), 109, 110)
#                            define BOOST_PP_NODE_111(p) BOOST_PP_IIF(p##(111), 111, 112)
#                define BOOST_PP_NODE_120(p) BOOST_PP_IIF(p##(120), BOOST_PP_NODE_116, BOOST_PP_NODE_124)
#                    define BOOST_PP_NODE_116(p) BOOST_PP_IIF(p##(116), BOOST_PP_NODE_114, BOOST_PP_NODE_118)
#                        define BOOST_PP_NODE_114(p) BOOST_PP_IIF(p##(114), BOOST_PP_NODE_113, BOOST_PP_NODE_115)
#                            define BOOST_PP_NODE_113(p) BOOST_PP_IIF(p##(113), 113, 114)
#                            define BOOST_PP_NODE_115(p) BOOST_PP_IIF(p##(115), 115, 116)
#                        define BOOST_PP_NODE_118(p) BOOST_PP_IIF(p##(118), BOOST_PP_NODE_117, BOOST_PP_NODE_119)
#                            define BOOST_PP_NODE_117(p) BOOST_PP_IIF(p##(117), 117, 118)
#                            define BOOST_PP_NODE_119(p) BOOST_PP_IIF(p##(119), 119, 120)
#                    define BOOST_PP_NODE_124(p) BOOST_PP_IIF(p##(124), BOOST_PP_NODE_122, BOOST_PP_NODE_126)
#                        define BOOST_PP_NODE_122(p) BOOST_PP_IIF(p##(122), BOOST_PP_NODE_121, BOOST_PP_NODE_123)
#                            define BOOST_PP_NODE_121(p) BOOST_PP_IIF(p##(121), 121, 122)
#                            define BOOST_PP_NODE_123(p) BOOST_PP_IIF(p##(123), 123, 124)
#                        define BOOST_PP_NODE_126(p) BOOST_PP_IIF(p##(126), BOOST_PP_NODE_125, BOOST_PP_NODE_127)
#                            define BOOST_PP_NODE_125(p) BOOST_PP_IIF(p##(125), 125, 126)
#                            define BOOST_PP_NODE_127(p) BOOST_PP_IIF(p##(127), 127, 128)
#    define BOOST_PP_NODE_192(p) BOOST_PP_IIF(p##(192), BOOST_PP_NODE_160, BOOST_PP_NODE_224)
#        define BOOST_PP_NODE_160(p) BOOST_PP_IIF(p##(160), BOOST_PP_NODE_144, BOOST_PP_NODE_176)
#            define BOOST_PP_NODE_144(p) BOOST_PP_IIF(p##(144), BOOST_PP_NODE_136, BOOST_PP_NODE_152)
#                define BOOST_PP_NODE_136(p) BOOST_PP_IIF(p##(136), BOOST_PP_NODE_132, BOOST_PP_NODE_140)
#                    define BOOST_PP_NODE_132(p) BOOST_PP_IIF(p##(132), BOOST_PP_NODE_130, BOOST_PP_NODE_134)
#                        define BOOST_PP_NODE_130(p) BOOST_PP_IIF(p##(130), BOOST_PP_NODE_129, BOOST_PP_NODE_131)
#                            define BOOST_PP_NODE_129(p) BOOST_PP_IIF(p##(129), 129, 130)
#                            define BOOST_PP_NODE_131(p) BOOST_PP_IIF(p##(131), 131, 132)
#                        define BOOST_PP_NODE_134(p) BOOST_PP_IIF(p##(134), BOOST_PP_NODE_133, BOOST_PP_NODE_135)
#                            define BOOST_PP_NODE_133(p) BOOST_PP_IIF(p##(133), 133, 134)
#                            define BOOST_PP_NODE_135(p) BOOST_PP_IIF(p##(135), 135, 136)
#                    define BOOST_PP_NODE_140(p) BOOST_PP_IIF(p##(140), BOOST_PP_NODE_138, BOOST_PP_NODE_142)
#                        define BOOST_PP_NODE_138(p) BOOST_PP_IIF(p##(138), BOOST_PP_NODE_137, BOOST_PP_NODE_139)
#                            define BOOST_PP_NODE_137(p) BOOST_PP_IIF(p##(137), 137, 138)
#                            define BOOST_PP_NODE_139(p) BOOST_PP_IIF(p##(139), 139, 140)
#                        define BOOST_PP_NODE_142(p) BOOST_PP_IIF(p##(142), BOOST_PP_NODE_141, BOOST_PP_NODE_143)
#                            define BOOST_PP_NODE_141(p) BOOST_PP_IIF(p##(141), 141, 142)
#                            define BOOST_PP_NODE_143(p) BOOST_PP_IIF(p##(143), 143, 144)
#                define BOOST_PP_NODE_152(p) BOOST_PP_IIF(p##(152), BOOST_PP_NODE_148, BOOST_PP_NODE_156)
#                    define BOOST_PP_NODE_148(p) BOOST_PP_IIF(p##(148), BOOST_PP_NODE_146, BOOST_PP_NODE_150)
#                        define BOOST_PP_NODE_146(p) BOOST_PP_IIF(p##(146), BOOST_PP_NODE_145, BOOST_PP_NODE_147)
#                            define BOOST_PP_NODE_145(p) BOOST_PP_IIF(p##(145), 145, 146)
#                            define BOOST_PP_NODE_147(p) BOOST_PP_IIF(p##(147), 147, 148)
#                        define BOOST_PP_NODE_150(p) BOOST_PP_IIF(p##(150), BOOST_PP_NODE_149, BOOST_PP_NODE_151)
#                            define BOOST_PP_NODE_149(p) BOOST_PP_IIF(p##(149), 149, 150)
#                            define BOOST_PP_NODE_151(p) BOOST_PP_IIF(p##(151), 151, 152)
#                    define BOOST_PP_NODE_156(p) BOOST_PP_IIF(p##(156), BOOST_PP_NODE_154, BOOST_PP_NODE_158)
#                        define BOOST_PP_NODE_154(p) BOOST_PP_IIF(p##(154), BOOST_PP_NODE_153, BOOST_PP_NODE_155)
#                            define BOOST_PP_NODE_153(p) BOOST_PP_IIF(p##(153), 153, 154)
#                            define BOOST_PP_NODE_155(p) BOOST_PP_IIF(p##(155), 155, 156)
#                        define BOOST_PP_NODE_158(p) BOOST_PP_IIF(p##(158), BOOST_PP_NODE_157, BOOST_PP_NODE_159)
#                            define BOOST_PP_NODE_157(p) BOOST_PP_IIF(p##(157), 157, 158)
#                            define BOOST_PP_NODE_159(p) BOOST_PP_IIF(p##(159), 159, 160)
#            define BOOST_PP_NODE_176(p) BOOST_PP_IIF(p##(176), BOOST_PP_NODE_168, BOOST_PP_NODE_184)
#                define BOOST_PP_NODE_168(p) BOOST_PP_IIF(p##(168), BOOST_PP_NODE_164, BOOST_PP_NODE_172)
#                    define BOOST_PP_NODE_164(p) BOOST_PP_IIF(p##(164), BOOST_PP_NODE_162, BOOST_PP_NODE_166)
#                        define BOOST_PP_NODE_162(p) BOOST_PP_IIF(p##(162), BOOST_PP_NODE_161, BOOST_PP_NODE_163)
#                            define BOOST_PP_NODE_161(p) BOOST_PP_IIF(p##(161), 161, 162)
#                            define BOOST_PP_NODE_163(p) BOOST_PP_IIF(p##(163), 163, 164)
#                        define BOOST_PP_NODE_166(p) BOOST_PP_IIF(p##(166), BOOST_PP_NODE_165, BOOST_PP_NODE_167)
#                            define BOOST_PP_NODE_165(p) BOOST_PP_IIF(p##(165), 165, 166)
#                            define BOOST_PP_NODE_167(p) BOOST_PP_IIF(p##(167), 167, 168)
#                    define BOOST_PP_NODE_172(p) BOOST_PP_IIF(p##(172), BOOST_PP_NODE_170, BOOST_PP_NODE_174)
#                        define BOOST_PP_NODE_170(p) BOOST_PP_IIF(p##(170), BOOST_PP_NODE_169, BOOST_PP_NODE_171)
#                            define BOOST_PP_NODE_169(p) BOOST_PP_IIF(p##(169), 169, 170)
#                            define BOOST_PP_NODE_171(p) BOOST_PP_IIF(p##(171), 171, 172)
#                        define BOOST_PP_NODE_174(p) BOOST_PP_IIF(p##(174), BOOST_PP_NODE_173, BOOST_PP_NODE_175)
#                            define BOOST_PP_NODE_173(p) BOOST_PP_IIF(p##(173), 173, 174)
#                            define BOOST_PP_NODE_175(p) BOOST_PP_IIF(p##(175), 175, 176)
#                define BOOST_PP_NODE_184(p) BOOST_PP_IIF(p##(184), BOOST_PP_NODE_180, BOOST_PP_NODE_188)
#                    define BOOST_PP_NODE_180(p) BOOST_PP_IIF(p##(180), BOOST_PP_NODE_178, BOOST_PP_NODE_182)
#                        define BOOST_PP_NODE_178(p) BOOST_PP_IIF(p##(178), BOOST_PP_NODE_177, BOOST_PP_NODE_179)
#                            define BOOST_PP_NODE_177(p) BOOST_PP_IIF(p##(177), 177, 178)
#                            define BOOST_PP_NODE_179(p) BOOST_PP_IIF(p##(179), 179, 180)
#                        define BOOST_PP_NODE_182(p) BOOST_PP_IIF(p##(182), BOOST_PP_NODE_181, BOOST_PP_NODE_183)
#                            define BOOST_PP_NODE_181(p) BOOST_PP_IIF(p##(181), 181, 182)
#                            define BOOST_PP_NODE_183(p) BOOST_PP_IIF(p##(183), 183, 184)
#                    define BOOST_PP_NODE_188(p) BOOST_PP_IIF(p##(188), BOOST_PP_NODE_186, BOOST_PP_NODE_190)
#                        define BOOST_PP_NODE_186(p) BOOST_PP_IIF(p##(186), BOOST_PP_NODE_185, BOOST_PP_NODE_187)
#                            define BOOST_PP_NODE_185(p) BOOST_PP_IIF(p##(185), 185, 186)
#                            define BOOST_PP_NODE_187(p) BOOST_PP_IIF(p##(187), 187, 188)
#                        define BOOST_PP_NODE_190(p) BOOST_PP_IIF(p##(190), BOOST_PP_NODE_189, BOOST_PP_NODE_191)
#                            define BOOST_PP_NODE_189(p) BOOST_PP_IIF(p##(189), 189, 190)
#                            define BOOST_PP_NODE_191(p) BOOST_PP_IIF(p##(191), 191, 192)
#        define BOOST_PP_NODE_224(p) BOOST_PP_IIF(p##(224), BOOST_PP_NODE_208, BOOST_PP_NODE_240)
#            define BOOST_PP_NODE_208(p) BOOST_PP_IIF(p##(208), BOOST_PP_NODE_200, BOOST_PP_NODE_216)
#                define BOOST_PP_NODE_200(p) BOOST_PP_IIF(p##(200), BOOST_PP_NODE_196, BOOST_PP_NODE_204)
#                    define BOOST_PP_NODE_196(p) BOOST_PP_IIF(p##(196), BOOST_PP_NODE_194, BOOST_PP_NODE_198)
#                        define BOOST_PP_NODE_194(p) BOOST_PP_IIF(p##(194), BOOST_PP_NODE_193, BOOST_PP_NODE_195)
#                            define BOOST_PP_NODE_193(p) BOOST_PP_IIF(p##(193), 193, 194)
#                            define BOOST_PP_NODE_195(p) BOOST_PP_IIF(p##(195), 195, 196)
#                        define BOOST_PP_NODE_198(p) BOOST_PP_IIF(p##(198), BOOST_PP_NODE_197, BOOST_PP_NODE_199)
#                            define BOOST_PP_NODE_197(p) BOOST_PP_IIF(p##(197), 197, 198)
#                            define BOOST_PP_NODE_199(p) BOOST_PP_IIF(p##(199), 199, 200)
#                    define BOOST_PP_NODE_204(p) BOOST_PP_IIF(p##(204), BOOST_PP_NODE_202, BOOST_PP_NODE_206)
#                        define BOOST_PP_NODE_202(p) BOOST_PP_IIF(p##(202), BOOST_PP_NODE_201, BOOST_PP_NODE_203)
#                            define BOOST_PP_NODE_201(p) BOOST_PP_IIF(p##(201), 201, 202)
#                            define BOOST_PP_NODE_203(p) BOOST_PP_IIF(p##(203), 203, 204)
#                        define BOOST_PP_NODE_206(p) BOOST_PP_IIF(p##(206), BOOST_PP_NODE_205, BOOST_PP_NODE_207)
#                            define BOOST_PP_NODE_205(p) BOOST_PP_IIF(p##(205), 205, 206)
#                            define BOOST_PP_NODE_207(p) BOOST_PP_IIF(p##(207), 207, 208)
#                define BOOST_PP_NODE_216(p) BOOST_PP_IIF(p##(216), BOOST_PP_NODE_212, BOOST_PP_NODE_220)
#                    define BOOST_PP_NODE_212(p) BOOST_PP_IIF(p##(212), BOOST_PP_NODE_210, BOOST_PP_NODE_214)
#                        define BOOST_PP_NODE_210(p) BOOST_PP_IIF(p##(210), BOOST_PP_NODE_209, BOOST_PP_NODE_211)
#                            define BOOST_PP_NODE_209(p) BOOST_PP_IIF(p##(209), 209, 210)
#                            define BOOST_PP_NODE_211(p) BOOST_PP_IIF(p##(211), 211, 212)
#                        define BOOST_PP_NODE_214(p) BOOST_PP_IIF(p##(214), BOOST_PP_NODE_213, BOOST_PP_NODE_215)
#                            define BOOST_PP_NODE_213(p) BOOST_PP_IIF(p##(213), 213, 214)
#                            define BOOST_PP_NODE_215(p) BOOST_PP_IIF(p##(215), 215, 216)
#                    define BOOST_PP_NODE_220(p) BOOST_PP_IIF(p##(220), BOOST_PP_NODE_218, BOOST_PP_NODE_222)
#                        define BOOST_PP_NODE_218(p) BOOST_PP_IIF(p##(218), BOOST_PP_NODE_217, BOOST_PP_NODE_219)
#                            define BOOST_PP_NODE_217(p) BOOST_PP_IIF(p##(217), 217, 218)
#                            define BOOST_PP_NODE_219(p) BOOST_PP_IIF(p##(219), 219, 220)
#                        define BOOST_PP_NODE_222(p) BOOST_PP_IIF(p##(222), BOOST_PP_NODE_221, BOOST_PP_NODE_223)
#                            define BOOST_PP_NODE_221(p) BOOST_PP_IIF(p##(221), 221, 222)
#                            define BOOST_PP_NODE_223(p) BOOST_PP_IIF(p##(223), 223, 224)
#            define BOOST_PP_NODE_240(p) BOOST_PP_IIF(p##(240), BOOST_PP_NODE_232, BOOST_PP_NODE_248)
#                define BOOST_PP_NODE_232(p) BOOST_PP_IIF(p##(232), BOOST_PP_NODE_228, BOOST_PP_NODE_236)
#                    define BOOST_PP_NODE_228(p) BOOST_PP_IIF(p##(228), BOOST_PP_NODE_226, BOOST_PP_NODE_230)
#                        define BOOST_PP_NODE_226(p) BOOST_PP_IIF(p##(226), BOOST_PP_NODE_225, BOOST_PP_NODE_227)
#                            define BOOST_PP_NODE_225(p) BOOST_PP_IIF(p##(225), 225, 226)
#                            define BOOST_PP_NODE_227(p) BOOST_PP_IIF(p##(227), 227, 228)
#                        define BOOST_PP_NODE_230(p) BOOST_PP_IIF(p##(230), BOOST_PP_NODE_229, BOOST_PP_NODE_231)
#                            define BOOST_PP_NODE_229(p) BOOST_PP_IIF(p##(229), 229, 230)
#                            define BOOST_PP_NODE_231(p) BOOST_PP_IIF(p##(231), 231, 232)
#                    define BOOST_PP_NODE_236(p) BOOST_PP_IIF(p##(236), BOOST_PP_NODE_234, BOOST_PP_NODE_238)
#                        define BOOST_PP_NODE_234(p) BOOST_PP_IIF(p##(234), BOOST_PP_NODE_233, BOOST_PP_NODE_235)
#                            define BOOST_PP_NODE_233(p) BOOST_PP_IIF(p##(233), 233, 234)
#                            define BOOST_PP_NODE_235(p) BOOST_PP_IIF(p##(235), 235, 236)
#                        define BOOST_PP_NODE_238(p) BOOST_PP_IIF(p##(238), BOOST_PP_NODE_237, BOOST_PP_NODE_239)
#                            define BOOST_PP_NODE_237(p) BOOST_PP_IIF(p##(237), 237, 238)
#                            define BOOST_PP_NODE_239(p) BOOST_PP_IIF(p##(239), 239, 240)
#                define BOOST_PP_NODE_248(p) BOOST_PP_IIF(p##(248), BOOST_PP_NODE_244, BOOST_PP_NODE_252)
#                    define BOOST_PP_NODE_244(p) BOOST_PP_IIF(p##(244), BOOST_PP_NODE_242, BOOST_PP_NODE_246)
#                        define BOOST_PP_NODE_242(p) BOOST_PP_IIF(p##(242), BOOST_PP_NODE_241, BOOST_PP_NODE_243)
#                            define BOOST_PP_NODE_241(p) BOOST_PP_IIF(p##(241), 241, 242)
#                            define BOOST_PP_NODE_243(p) BOOST_PP_IIF(p##(243), 243, 244)
#                        define BOOST_PP_NODE_246(p) BOOST_PP_IIF(p##(246), BOOST_PP_NODE_245, BOOST_PP_NODE_247)
#                            define BOOST_PP_NODE_245(p) BOOST_PP_IIF(p##(245), 245, 246)
#                            define BOOST_PP_NODE_247(p) BOOST_PP_IIF(p##(247), 247, 248)
#                    define BOOST_PP_NODE_252(p) BOOST_PP_IIF(p##(252), BOOST_PP_NODE_250, BOOST_PP_NODE_254)
#                        define BOOST_PP_NODE_250(p) BOOST_PP_IIF(p##(250), BOOST_PP_NODE_249, BOOST_PP_NODE_251)
#                            define BOOST_PP_NODE_249(p) BOOST_PP_IIF(p##(249), 249, 250)
#                            define BOOST_PP_NODE_251(p) BOOST_PP_IIF(p##(251), 251, 252)
#                        define BOOST_PP_NODE_254(p) BOOST_PP_IIF(p##(254), BOOST_PP_NODE_253, BOOST_PP_NODE_255)
#                            define BOOST_PP_NODE_253(p) BOOST_PP_IIF(p##(253), 253, 254)
#                            define BOOST_PP_NODE_255(p) BOOST_PP_IIF(p##(255), 255, 256)
#
# endif


code:
#if !defined(BOOST_PP_IS_ITERATING)

///// header body

#ifndef BOOST_MPL_APPLY_HPP_INCLUDED
#define BOOST_MPL_APPLY_HPP_INCLUDED

// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.

// $Id$
// $Date$
// $Revision$

#if !defined(BOOST_MPL_PREPROCESSING_MODE)
#   include <boost/mpl/apply_fwd.hpp>
#   include <boost/mpl/apply_wrap.hpp>
#   include <boost/mpl/placeholders.hpp>
#   include <boost/mpl/lambda.hpp>
#   include <boost/mpl/aux_/na.hpp>
#   include <boost/mpl/aux_/lambda_support.hpp>
#endif

#include <boost/mpl/aux_/config/use_preprocessed.hpp>

#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
    && !defined(BOOST_MPL_PREPROCESSING_MODE)

#   define BOOST_MPL_PREPROCESSED_HEADER apply.hpp
#   include <boost/mpl/aux_/include_preprocessed.hpp>

#else

#   include <boost/mpl/limits/arity.hpp>
#   include <boost/mpl/aux_/preprocessor/params.hpp>
#   include <boost/mpl/aux_/preprocessor/default_params.hpp>
#   include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp>
#   include <boost/mpl/aux_/preprocessor/enum.hpp>
#   include <boost/mpl/aux_/config/lambda.hpp>
#   include <boost/mpl/aux_/config/dtp.hpp>
#   include <boost/mpl/aux_/nttp_decl.hpp>
#   include <boost/mpl/aux_/config/eti.hpp>
#   include <boost/mpl/aux_/config/msvc.hpp>
#   include <boost/mpl/aux_/config/workaround.hpp>

#   include <boost/preprocessor/comma_if.hpp>
#   include <boost/preprocessor/inc.hpp>
#   include <boost/preprocessor/iterate.hpp>
#   include <boost/preprocessor/cat.hpp>

namespace boost { namespace mpl {

// local macros, #undef-ined at the end of the header
#   define AUX778076_APPLY_PARAMS(param) \
    BOOST_MPL_PP_PARAMS( \
          BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
        , param \
        ) \
    /**/

#   define AUX778076_APPLY_DEF_PARAMS(param, value) \
    BOOST_MPL_PP_DEFAULT_PARAMS( \
          BOOST_MPL_LIMIT_METAFUNCTION_ARITY \
        , param \
        , value \
        ) \
    /**/

#   define AUX778076_APPLY_N_PARAMS(n, param) \
    BOOST_MPL_PP_PARAMS(n, param) \
    /**/

#   define AUX778076_APPLY_N_COMMA_PARAMS(n, param) \
    BOOST_PP_COMMA_IF(n) \
    BOOST_MPL_PP_PARAMS(n, param) \
    /**/

#   define AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(n, param, def) \
    BOOST_PP_COMMA_IF(n) \
    BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \
    /**/

#   define AUX778076_APPLY_N_SPEC_PARAMS(n, param) \
    BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \
    /**/

#define BOOST_PP_ITERATION_PARAMS_1 \
    (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply.hpp>))
#include BOOST_PP_ITERATE()

#   if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
// real C++ version is already taken care of
#   if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)

namespace aux {
// apply_count_args
#define AUX778076_COUNT_ARGS_PREFIX apply
#define AUX778076_COUNT_ARGS_DEFAULT na
#define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY
#include <boost/mpl/aux_/count_args.hpp>
}

template<
      typename F, AUX778076_APPLY_DEF_PARAMS(typename T, na)
    >
struct apply
    : aux::apply_chooser<
          aux::apply_count_args< AUX778076_APPLY_PARAMS(T) >::value
        >::template result_< F, AUX778076_APPLY_PARAMS(T) >::type
{
};

#   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#   endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE

#   undef AUX778076_APPLY_N_SPEC_PARAMS
#   undef AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS
#   undef AUX778076_APPLY_N_COMMA_PARAMS
#   undef AUX778076_APPLY_N_PARAMS
#   undef AUX778076_APPLY_DEF_PARAMS
#   undef AUX778076_APPLY_PARAMS

}}

#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_APPLY_HPP_INCLUDED

///// iteration, depth == 1

// For gcc 4.4 compatability, we must include the
// BOOST_PP_ITERATION_DEPTH test inside an #else clause.
#else // BOOST_PP_IS_ITERATING
#if BOOST_PP_ITERATION_DEPTH() == 1

#   define i_ BOOST_PP_FRAME_ITERATION(1)

template<
      typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
    >
struct BOOST_PP_CAT(apply,i_)
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
    : BOOST_PP_CAT(apply_wrap,i_)<
          typename lambda<F>::type
        AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
        >
{
#else
{
    typedef typename BOOST_PP_CAT(apply_wrap,i_)<
          typename lambda<F>::type
        AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
        >::type type;
#endif
    BOOST_MPL_AUX_LAMBDA_SUPPORT(
          BOOST_PP_INC(i_)
        , BOOST_PP_CAT(apply,i_)
        , (F AUX778076_APPLY_N_COMMA_PARAMS(i_,T))
        )
};

#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
/// workaround for ETI bug
template<>
struct BOOST_PP_CAT(apply,i_)<AUX778076_APPLY_N_SPEC_PARAMS(i_, int)>
{
    typedef int type;
};
#endif

#   if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
#   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)

#if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY
/// primary template (not a specialization!)
template<
      typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
    >
struct apply
    : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
{
};
#else
template<
      typename F AUX778076_APPLY_N_COMMA_PARAMS(i_, typename T)
    >
struct apply< F AUX778076_APPLY_N_PARTIAL_SPEC_PARAMS(i_, T, na) >
    : BOOST_PP_CAT(apply,i_)< F AUX778076_APPLY_N_COMMA_PARAMS(i_, T) >
{
};
#endif

#   else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

#if !defined(BOOST_MPL_CFG_NO_APPLY_TEMPLATE)
namespace aux {

template<>
struct apply_chooser<i_>
{
    template<
          typename F, AUX778076_APPLY_PARAMS(typename T)
        >
    struct result_
    {
        typedef BOOST_PP_CAT(apply,i_)<
              F AUX778076_APPLY_N_COMMA_PARAMS(i_, T)
            > type;
    };
};

} // namespace aux
#endif

#   endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#   endif // BOOST_MPL_CFG_NO_APPLY_TEMPLATE

#   undef i_

#endif // BOOST_PP_ITERATION_DEPTH()
#endif // BOOST_PP_IS_ITERATING


code:
#ifndef BOOST_MPL_MAP_HPP_INCLUDED
#define BOOST_MPL_MAP_HPP_INCLUDED

// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.

// $Id$
// $Date$
// $Revision$

#if !defined(BOOST_MPL_PREPROCESSING_MODE)
#   include <boost/mpl/limits/map.hpp>
#   include <boost/mpl/aux_/na.hpp>
#   include <boost/mpl/aux_/config/preprocessor.hpp>

#   include <boost/preprocessor/inc.hpp>
#   include <boost/preprocessor/cat.hpp>
#   include <boost/preprocessor/stringize.hpp>

#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING)
#   define AUX778076_MAP_HEADER \
    BOOST_PP_CAT(map, BOOST_MPL_LIMIT_MAP_SIZE).hpp \
    /**/
#else
#   define AUX778076_MAP_HEADER \
    BOOST_PP_CAT(map, BOOST_MPL_LIMIT_MAP_SIZE)##.hpp \
    /**/
#endif

#   include BOOST_PP_STRINGIZE(boost/mpl/map/AUX778076_MAP_HEADER)
#   undef AUX778076_MAP_HEADER
#endif

#include <boost/mpl/aux_/config/use_preprocessed.hpp>

#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
    && !defined(BOOST_MPL_PREPROCESSING_MODE)

#   define BOOST_MPL_PREPROCESSED_HEADER map.hpp
#   include <boost/mpl/aux_/include_preprocessed.hpp>

#else

#   include <boost/mpl/limits/map.hpp>

#   define AUX778076_SEQUENCE_NAME map
#   define AUX778076_SEQUENCE_LIMIT BOOST_MPL_LIMIT_MAP_SIZE
#   include <boost/mpl/aux_/sequence_wrapper.hpp>

#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#endif // BOOST_MPL_MAP_HPP_INCLUDED


code:
//  Copyright John Maddock 2007.
//  Use, modification and distribution are subject to the
//  Boost Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_MATH_MODF_HPP
#define BOOST_MATH_MODF_HPP

#ifdef _MSC_VER
#pragma once
#endif

#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/special_functions/trunc.hpp>

namespace boost{ namespace math{

template <class T, class Policy>
inline T modf(const T& v, T* ipart, const Policy& pol)
{
   *ipart = trunc(v, pol);
   return v - *ipart;
}
template <class T>
inline T modf(const T& v, T* ipart)
{
   return modf(v, ipart, policies::policy<>());
}

template <class T, class Policy>
inline T modf(const T& v, int* ipart, const Policy& pol)
{
   *ipart = itrunc(v, pol);
   return v - *ipart;
}
template <class T>
inline T modf(const T& v, int* ipart)
{
   return modf(v, ipart, policies::policy<>());
}

template <class T, class Policy>
inline T modf(const T& v, long* ipart, const Policy& pol)
{
   *ipart = ltrunc(v, pol);
   return v - *ipart;
}
template <class T>
inline T modf(const T& v, long* ipart)
{
   return modf(v, ipart, policies::policy<>());
}

#ifdef BOOST_HAS_LONG_LONG
template <class T, class Policy>
inline T modf(const T& v, boost::long_long_type* ipart, const Policy& pol)
{
   *ipart = lltrunc(v, pol);
   return v - *ipart;
}
template <class T>
inline T modf(const T& v, boost::long_long_type* ipart)
{
   return modf(v, ipart, policies::policy<>());
}
#endif

}} // namespaces

#endif // BOOST_MATH_MODF_HPP


code:
/*=============================================================================
    Copyright (c) 1999-2003 Jaakko Jarvi
    Copyright (c) 2001-2011 Joel de Guzman

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_GREATER_EQUAL_05052005_0432)
#define FUSION_GREATER_EQUAL_05052005_0432

#include <boost/fusion/support/config.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/sequence/comparison/enable_comparison.hpp>

#if defined(FUSION_DIRECT_OPERATOR_USAGE)
#include <boost/fusion/sequence/comparison/detail/greater_equal.hpp>
#else
#include <boost/fusion/sequence/comparison/less.hpp>
#endif

namespace boost { namespace fusion
{
    template <typename Seq1, typename Seq2>
    BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
    inline bool
    greater_equal(Seq1 const& a, Seq2 const& b)
    {
#if defined(FUSION_DIRECT_OPERATOR_USAGE)
        return detail::sequence_greater_equal<Seq1 const, Seq2 const>::
            call(fusion::begin(a), fusion::begin(b));
#else
        return !(a < b);
#endif
    }

    namespace operators
    {
        template <typename Seq1, typename Seq2>
        BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
        inline typename
            boost::enable_if<
                traits::enable_comparison<Seq1, Seq2>
              , bool
            >::type
        operator>=(Seq1 const& a, Seq2 const& b)
        {
            return fusion::greater_equal(a, b);
        }
    }
    using operators::operator>=;
}}

#endif


code:
//  (C) Copyright John Maddock 2006.
//  Use, modification and distribution are subject to the
//  Boost Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_MATH_SPECIAL_HERMITE_HPP
#define BOOST_MATH_SPECIAL_HERMITE_HPP

#ifdef _MSC_VER
#pragma once
#endif

#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/policies/error_handling.hpp>

namespace boost{
namespace math{

// Recurrance relation for Hermite polynomials:
template <class T1, class T2, class T3>
inline typename tools::promote_args<T1, T2, T3>::type
   hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1)
{
   return (2 * x * Hn - 2 * n * Hnm1);
}

namespace detail{

// Implement Hermite polynomials via recurrance:
template <class T>
T hermite_imp(unsigned n, T x)
{
   T p0 = 1;
   T p1 = 2 * x;

   if(n == 0)
      return p0;

   unsigned c = 1;

   while(c < n)
   {
      std::swap(p0, p1);
      p1 = hermite_next(c, x, p0, p1);
      ++c;
   }
   return p1;
}

} // namespace detail

template <class T, class Policy>
inline typename tools::promote_args<T>::type
   hermite(unsigned n, T x, const Policy&)
{
   typedef typename tools::promote_args<T>::type result_type;
   typedef typename policies::evaluation<result_type, Policy>::type value_type;
   return policies::checked_narrowing_cast<result_type, Policy>(detail::hermite_imp(n, static_cast<value_type>(x)), "boost::math::hermite<%1%>(unsigned, %1%)");
}

template <class T>
inline typename tools::promote_args<T>::type
   hermite(unsigned n, T x)
{
   return boost::math::hermite(n, x, policies::policy<>());
}

} // namespace math
} // namespace boost

#endif // BOOST_MATH_SPECIAL_HERMITE_HPP


code:
#ifndef BOOST_MPL_LESS_EQUAL_HPP_INCLUDED
#define BOOST_MPL_LESS_EQUAL_HPP_INCLUDED

// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.

// $Id$
// $Date$
// $Revision$

#define AUX778076_OP_NAME less_equal
#define AUX778076_OP_TOKEN <=
#include <boost/mpl/aux_/comparison_op.hpp>

#endif // BOOST_MPL_LESS_EQUAL_HPP_INCLUDED


code:
/*=============================================================================
    Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
    http://spirit.sourceforge.net/

  Distributed under the Boost Software License, Version 1.0. (See accompanying
  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP
#define BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP

#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>

namespace boost { namespace spirit {

BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN

    ///////////////////////////////////////////////////////////////////////////
    //  Summary:
    //  A semantic action policy that insert data into an associative
    //  container using a const reference to data.
    //  (This doc uses convention available in actors.hpp)
    //
    //  Actions (what it does):
    //      ref.insert( T::value_type(value,value_ref) );
    //      ref.insert( T::value_type(T::key_type(first,last), value_ref));;
    //
    //  Policy name:
    //      insert_key_action
    //
    //  Policy holder, corresponding helper method:
    //      ref_const_ref_value_actor, insert_key_a( ref, value_ref );
    //
    //  () operators: both
    //
    //  See also ref_const_ref_value_actor for more details.
    ///////////////////////////////////////////////////////////////////////////
    struct insert_key_action
    {
        template<
            typename T,
            typename ValueT,
            typename ReferentT
        >
        void act(
            T& ref_,
            ValueT const& value_,
            ReferentT const& key_
            ) const
        {
            typedef typename T::value_type value_type;
            value_type key_value(key_, value_);
            ref_.insert( key_value );
        }

        template<
            typename T,
            typename ValueT,
            typename IteratorT
        >
        void act(
            T& ref_,
            ValueT const& value_,
            IteratorT const& first_,
            IteratorT const& last_
            ) const
        {
            typedef typename T::key_type key_type;
            typedef typename T::value_type value_type;

            key_type key(first_,last_);
            value_type key_value(key, value_);
            ref_.insert( key_value );
        }
    };

    template<
        typename T,
        typename ValueT
        >
    inline ref_const_ref_value_actor<T,ValueT,insert_key_action> insert_key_a(
        T& ref_,
        ValueT const& value_
        )
    {
        return ref_const_ref_value_actor<
            T,
            ValueT,
            insert_key_action
            >(ref_,value_);
    }

BOOST_SPIRIT_CLASSIC_NAMESPACE_END

}}

#endif


code:
/*=============================================================================
    Copyright (c) 2011 Hartmut Kaiser

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/

#if !defined(BOOST_PHOENIX_PREPROCESSED_BIND_MEMBER_FUNCTION_HPP)
#define BOOST_PHOENIX_PREPROCESSED_BIND_MEMBER_FUNCTION_HPP

#if BOOST_PHOENIX_LIMIT <= 10
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_10.hpp>
#elif BOOST_PHOENIX_LIMIT <= 20
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_20.hpp>
#elif BOOST_PHOENIX_LIMIT <= 30
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_30.hpp>
#elif BOOST_PHOENIX_LIMIT <= 40
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_40.hpp>
#elif BOOST_PHOENIX_LIMIT <= 50
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_member_function_50.hpp>
#else
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
#endif

#endif