intmain(){ std::string s = "000111000111ababab000111000111"; std::cout << s << std::endl; auto x = boost::algorithm::find_first(s,"000"); x = boost::algorithm::find_last(s,"1"); x = boost::algorithm::find_nth(s,"1",3); x = boost::algorithm::find_tail(s,3); x = boost::algorithm::find_head(s,3); std::cout << s << std::endl; //std::cout << boost::algorithm::find_last(s, "111") << std::endl; }
namespace detail{ // // We can't filter out rvalue_references at the same level as // references or we get ambiguities from msvc: // template <classT> structremove_rvalue_ref { typedef T type; }; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <classT> structremove_rvalue_ref<T&&> { typedef T type; }; #endif
#if defined(BOOST_ILLEGAL_CV_REFERENCES) // these are illegal specialisations; cv-qualifies applied to // references have no effect according to [8.3.2p1], // C++ Builder requires them though as it treats cv-qualified // references as distinct types... template <classT> structremove_reference<T&const>{ typedef T type; }; template <classT> structremove_reference<T&volatile>{ typedef T type; }; template <classT> structremove_reference<T&constvolatile>{ typedef T type; }; #endif
nonref * result = any_cast<nonref>(boost::addressof(operand)); if(!result) boost::throw_exception(bad_any_cast());
// Attempt to avoid construction of a temporary object in cases when // `ValueType` is not a reference. Example: // `static_cast<std::string>(*result);` // which is equal to `std::string(*result);` typedef BOOST_DEDUCED_TYPENAME boost::conditional< boost::is_reference<ValueType>::value, ValueType, BOOST_DEDUCED_TYPENAME boost::add_reference<ValueType>::type >::type ref_type; #ifdef BOOST_MSVC # pragmawarning(push) # pragmawarning(disable: 4172) // "returning address of local variable or temporary" but *result is not local! #endif returnstatic_cast<ref_type>(*result); #ifdef BOOST_MSVC # pragmawarning(pop) #endif }