Index: boost/xpressive/detail/utility/sequence_stack.hpp =================================================================== --- boost/xpressive/detail/utility/sequence_stack.hpp (revision 53535) +++ boost/xpressive/detail/utility/sequence_stack.hpp (working copy) @@ -173,8 +173,7 @@ this->begin_ = this->curr_ = this->end_ = 0; } - template - T *push_sequence(std::size_t count, mpl::bool_) + T *push_sequence(std::size_t count) { // This is the ptr to return T *ptr = this->curr_; @@ -192,17 +191,15 @@ return this->grow_(count); } - if(Fill) - { - std::fill_n(ptr, count, T()); - } - return ptr; } - T *push_sequence(std::size_t count) + template + T *push_sequence(std::size_t count, U const &u) { - return this->push_sequence(count, mpl::true_()); + T *ptr = this->push_sequence(count); + std::fill_n(ptr, count, u); + return ptr; } void unwind_to(T *ptr) @@ -229,9 +226,6 @@ } }; -typedef mpl::false_ no_fill_t; -no_fill_t const no_fill = {}; - }}} // namespace boost::xpressive::detail #if defined(_MSC_VER) && (_MSC_VER >= 1020) Index: boost/xpressive/detail/core/state.hpp =================================================================== --- boost/xpressive/detail/core/state.hpp (revision 53535) +++ boost/xpressive/detail/core/state.hpp (working copy) @@ -289,7 +289,7 @@ this->context_.results_ptr_ = &what; this->context_.traits_ = impl.traits_.get(); this->mark_count_ = impl.mark_count_ + 1; - this->sub_matches_ = this->extras_->sub_match_stack_.push_sequence(total_mark_count); + this->sub_matches_ = this->extras_->sub_match_stack_.push_sequence(total_mark_count, detail::sub_match_impl_default()); this->sub_matches_ += impl.hidden_mark_count_; // initialize the match_results struct @@ -329,7 +329,7 @@ { memento mem = { - state.extras_->sub_match_stack_.push_sequence(state.mark_count_, no_fill) + state.extras_->sub_match_stack_.push_sequence(state.mark_count_) , state.context_.results_ptr_->nested_results().size() , state.action_list_.next , state.action_list_tail_ Index: boost/xpressive/detail/core/sub_match_impl.hpp =================================================================== --- boost/xpressive/detail/core/sub_match_impl.hpp (revision 53535) +++ boost/xpressive/detail/core/sub_match_impl.hpp (working copy) @@ -23,6 +23,13 @@ // need is trivial constructor/destructor. (???) /////////////////////////////////////////////////////////////////////////////// +// sub_match_impl_default +// +struct sub_match_impl_default +{ +}; + +/////////////////////////////////////////////////////////////////////////////// // sub_match_impl // template @@ -40,6 +47,14 @@ , zero_width_(false) { } + + sub_match_impl &operator =(sub_match_impl_default const &) + { + this->matched = false; + this->repeat_count_ = 0; + this->zero_width_ = false; + return *this; + } }; }}} // namespace boost::xpressive::detail Index: boost/xpressive/match_results.hpp =================================================================== --- boost/xpressive/match_results.hpp (revision 53535) +++ boost/xpressive/match_results.hpp (working copy) @@ -410,7 +410,7 @@ { extras_type &extras = this->get_extras_(); std::size_t size = that.sub_matches_.size(); - detail::sub_match_impl *sub_matches = extras.sub_match_stack_.push_sequence(size); + detail::sub_match_impl *sub_matches = extras.sub_match_stack_.push_sequence(size, detail::sub_match_impl_default()); detail::core_access::init_sub_match_vector(this->sub_matches_, sub_matches, size, that.sub_matches_); // BUGBUG this doesn't share the extras::sequence_stack