Boost C++ 库

...世界上最受推崇和设计精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu,《C++ 编码规范

函数模板 join_if - Boost C++ 函数库
PrevUpHomeNext

函数模板 join_if

boost::algorithm::join_if — 条件连接算法。

提要

// In header: <boost/algorithm/string/regex.hpp>


template<typename SequenceSequenceT, typename Range1T, typename CharT, 
         typename RegexTraitsT> 
  range_value< SequenceSequenceT >::type 
  join_if(const SequenceSequenceT & Input, const Range1T & Separator, 
          const basic_regex< CharT, RegexTraitsT > & Rx, 
          match_flag_type Flags = match_default);

描述

此算法将“列表”中的所有字符串连接成一个长字符串。片段通过给定的分隔符连接。只有与给定正则表达式匹配的片段才会被添加到结果中。

这是 join_if 算法的一个特化版本。

[Note] 注意

此函数提供强异常安全保证

参数

输入

一个包含输入字符串的容器。它必须是一个容器的容器。

分隔符

用于分隔连接片段的字符串。

Rx

正则表达式

标志

正则表达式选项

返回

连接后的字符串。


PrevUpHomeNext