2012-02-03 16 views
1

私は何を印刷できるかを返すことができる機能を持っているので、ページの出力を印刷することができます。どちらのif文の中に出力される文字列を両方とも返しますか?関数から複数の文字列を返す

std::vector<std::string> el; 
     split(el,message,boost::is_any_of("\n")); 
     std::string a (""); 

      for(int i = 0; i < el.size(); i++) 
      { 
       if(el[i].substr(0,3) == ".X/") 
       { 
        DCS_LOG_DEBUG("--------------- Validating .X/ ---------------") 
        std::string str = el[i].substr(3); 
        std::vector<std::string>st; 
        split(st,str,boost::is_any_of("/")); 
        boost::regex const string_matcher(splitMask[0]); 
        if(boost::regex_match(st[0],string_matcher)) 
        { 
         a = "Correct Security Instruction"; 

        } 
        else 
        { 
         a = "Incorrect Security Instruction" 
        } 

        boost::regex const string_matcher1(splitMask[1]); 
        if(boost::regex_match(st[1],string_matcher1)) 
        { 
        a = "Correct Security screening result" 
        } 
        else 
        { 
         a = "Incorrect Security screening result" 
        } 


        return a; 

       } 

      } 

Thankfull任意のヘルプ:)

答えて

0

あなたが参照として関数に渡され、以降の復帰時にベクトルを反復されるのstd ::ベクトルで文字列をプッシュすることができます。

3

のためのあなたは、例えば、文字列のstd::pairを返すことができます。

3

は2適切な名前の文字列のメンバーを持つクラスを定義し、そのインスタンスを返します。

次に、メソッドやその他のデータは、そのクラスに持っていることは有用であろうかについて考え始めます。

0

std::pairboolの値(指示が正しいかどうかを示す1つと、スクリーニング結果が正しいかどうかを示す1つ)を返し、呼び出しコードが結果を解釈するようにします。

関連する問題