diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index b8bc9963..9cc4abe8 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -375,8 +375,13 @@ bool basic_regex_parser::parse_open_paren() if(0 == (this->flags() & regbase::nosubs)) { markid = ++m_mark_count; +#ifndef BOOST_NO_STD_DISTANCE if(this->flags() & regbase::save_subexpression_location) this->m_pdata->m_subs.push_back(std::pair(std::distance(m_base, m_position) - 1, 0)); +#else + if(this->flags() & regbase::save_subexpression_location) + this->m_pdata->m_subs.push_back(std::pair((m_position - m_base) - 1, 0)); +#endif } re_brace* pb = static_cast(this->append_state(syntax_element_startmark, sizeof(re_brace))); pb->index = markid; @@ -424,8 +429,13 @@ bool basic_regex_parser::parse_open_paren() return false; } BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark); +#ifndef BOOST_NO_STD_DISTANCE if(markid && (this->flags() & regbase::save_subexpression_location)) this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position); +#else + if(markid && (this->flags() & regbase::save_subexpression_location)) + this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base); +#endif ++m_position; // // append closing parenthesis state: diff --git a/include/boost/regex/v4/iterator_category.hpp b/include/boost/regex/v4/iterator_category.hpp index 20870a0c..9e401423 100644 --- a/include/boost/regex/v4/iterator_category.hpp +++ b/include/boost/regex/v4/iterator_category.hpp @@ -31,10 +31,14 @@ namespace detail{ template struct is_random_imp { +#ifndef BOOST_NO_STD_ITERATOR_TRAITS private: typedef typename std::iterator_traits::iterator_category cat; public: BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible::value)); +#else + BOOST_STATIC_CONSTANT(bool, value = false); +#endif }; template