⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stltest.h

📁 STL的一些技巧例子。
💻 H
字号:
#include <functional>
#include <iostream>
#include <algorithm>
#include <vector>
#include "atlstr.h"
//#include <openssl/evp.h>

using namespace std;

enum findmodes 

{

 FM_INVALID = 0,

 FM_IS,

 FM_STARTSWITH,

 FM_ENDSWITH,

 FM_CONTAINS

};

typedef struct tagFindStr

{

 UINT iMode;

 CString szMatchStr;

} FindStr;

typedef FindStr* LPFINDSTR;

class FindMatchingString 

    : public std::unary_function<CString, bool> 

{

    

public: 

	int Test_Remove_if();
	void Test_ZipVector();
	void Test_StdAt(int iAt);
	void Test_Swap();



	FindMatchingString(const LPFINDSTR lpFS) : m_lpFS(lpFS) {} 

  bool operator()(CString& szStringToCompare) const 

  { 

     bool retVal = false;

 

     switch(m_lpFS->iMode) 

     {

     case FM_IS: 

       { 
		   if(szStringToCompare=="12345哈哈")
			   szStringToCompare="111";

 //        retVal = (szStringToCompare 
//			 == "556677"); 

         break;

       }

     case FM_STARTSWITH: 

       { 

         retVal = (szStringToCompare.Left(1)

               == 2);

         break;

       } 

     case FM_ENDSWITH: 

       {

         retVal = (szStringToCompare.Right(1) 

               == 3);


         break; 

       } 

     case FM_CONTAINS: 

       {

         retVal = (szStringToCompare.Find(2) != -1);

         break; 

       }

     }

        

     return retVal;

 }

        

private: 

    LPFINDSTR m_lpFS;

};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -