當前位置: 首頁>>代碼示例>>C++>>正文


C++ Compare函數代碼示例

本文整理匯總了C++中Compare函數的典型用法代碼示例。如果您正苦於以下問題:C++ Compare函數的具體用法?C++ Compare怎麽用?C++ Compare使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Compare函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: value_comparison

 value_comparison(KeyFromValue key_=KeyFromValue(),Compare comp_=Compare()):
   key(key_),comp(comp_)
 {
 }
開發者ID:AlexRa,項目名稱:Kirstens-clone,代碼行數:4,代碼來源:value_compare.hpp

示例2: equal

int equal(const char *s1, const char *s2) {
  return Compare(s1, s2) == 0;
}
開發者ID:LegalizeAdulthood,項目名稱:clang,代碼行數:3,代碼來源:builtins.cpp

示例3: Compare

	int Compare(LPARAM lParam1, LPARAM lParam2)
	{
		return Compare(
			(CShadowTree*)m_pList->GetItemData((int)lParam1),
			(CShadowTree*)m_pList->GetItemData((int)lParam2));
	}
開發者ID:3F,項目名稱:tortoisegit-mdc,代碼行數:6,代碼來源:BrowseRefsDlg.cpp

示例4: Compare

int String::Compare(const char* str, bool caseSensitive) const
{
    return Compare(CString(), str, caseSensitive);
}
開發者ID:newbthenewbd,項目名稱:Urho3D,代碼行數:4,代碼來源:Str.cpp

示例5: p1

    // key -> value access
    value_ref_type  operator[]( key_param_type key ) const
    {
        iterator it = boost::detail::lower_bound( m_map.begin(), m_map.end(), key, p1() );

        return (it == m_map.end() || Compare()( key, it->first ) ) ? m_invalid_value : it->second;
    }
開發者ID:TheForum,項目名稱:Earth-and-Beyond-server,代碼行數:7,代碼來源:fixed_mapping.hpp

示例6: main

main(int    argc,
     char **argv)
{
l_int32      error;
l_uint32    *data;
PIX         *pix1, *pix2, *pix3, *pix1c, *pix2c, *pix1t, *pix2t, *pixd;
PIXA        *pixa;
static char  mainName[] = "pixmem_reg";

    error = 0;
    pixa = pixaCreate(0);

        /* Copy with internal resizing: onto a cmapped image */
    pix1 = pixRead("weasel4.16c.png");
    pix2 = pixRead("feyn-fract.tif");
    pix3 = pixRead("lucasta.150.jpg");
    fprintf(stderr, "before copy 2 --> 3\n");
    pixCopy(pix3, pix2);
    Compare(pix2, pix3, &error);
    pixSaveTiled(pix3, pixa, 4, 1, 30, 32);
    fprintf(stderr, "before copy 3 --> 1\n");
    pixCopy(pix1, pix3);
    Compare(pix2, pix1, &error);
    pixSaveTiled(pix1, pixa, 4, 0, 30, 32);
    pixDestroy(&pix1);
    pixDestroy(&pix2);
    pixDestroy(&pix3);

        /* Copy with internal resizing: from a cmapped image */
    pix1 = pixRead("weasel4.16c.png");
    pix2 = pixRead("feyn-fract.tif");
    pix3 = pixRead("lucasta.150.jpg");
    fprintf(stderr, "before copy 1 --> 2\n");
    pixCopy(pix2, pix1);
    Compare(pix2, pix1, &error);
    pixSaveTiled(pix2, pixa, 1, 1, 30, 32);
    fprintf(stderr, "before copy 2 --> 3\n");
    pixCopy(pix3, pix2);
    Compare(pix3, pix2, &error);
    pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
    pixDestroy(&pix1);
    pixDestroy(&pix2);
    pixDestroy(&pix3);

        /* Transfer of data pixs --> pixd, when pixs is not cloned.
         * pixs is destroyed.  */
    pix1 = pixRead("weasel4.16c.png");
    pix2 = pixRead("feyn-fract.tif");
    pix3 = pixRead("lucasta.150.jpg");
    pix1c = pixCopy(NULL, pix1);
    fprintf(stderr, "before transfer 1 --> 2\n");
    pixTransferAllData(pix2, &pix1, 0, 0);
    Compare(pix2, pix1c, &error);
    pixSaveTiled(pix2, pixa, 1, 1, 30, 32);
    fprintf(stderr, "before transfer 2 --> 3\n");
    pixTransferAllData(pix3, &pix2, 0, 0);
    Compare(pix3, pix1c, &error);
    pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
    pixDestroy(&pix1c);
    pixDestroy(&pix3);

        /* Another transfer of data pixs --> pixd, when pixs is not cloned.
         * pixs is destroyed. */
    pix1 = pixRead("weasel4.16c.png");
    pix2 = pixRead("feyn-fract.tif");
    pix3 = pixRead("lucasta.150.jpg");
    pix1c = pixCopy(NULL, pix1);
    pix2c = pixCopy(NULL, pix2);
    fprintf(stderr, "before copy transfer 1 --> 2\n");
    pixTransferAllData(pix2, &pix1c, 0, 0);
    Compare(pix2, pix1, &error);
    pixSaveTiled(pix2, pixa, 1, 0, 30, 32);
    fprintf(stderr, "before copy transfer 2 --> 3\n");
    pixTransferAllData(pix3, &pix2, 0, 0);
    Compare(pix3, pix1, &error);
    pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
    pixDestroy(&pix1);
    pixDestroy(&pix2c);
    pixDestroy(&pix3);

        /* Transfer of data pixs --> pixd, when pixs is cloned.
         * pixs has its refcount reduced by 1. */
    pix1 = pixRead("weasel4.16c.png");
    pix2 = pixRead("feyn-fract.tif");
    pix3 = pixRead("lucasta.150.jpg");
    pix1c = pixClone(pix1);
    pix2c = pixClone(pix2);
    fprintf(stderr, "before clone transfer 1 --> 2\n");
    pixTransferAllData(pix2, &pix1c, 0, 0);
    Compare(pix2, pix1, &error);
    pixSaveTiled(pix2, pixa, 1, 0, 30, 32);
    fprintf(stderr, "before clone transfer 2 --> 3\n");
    pixTransferAllData(pix3, &pix2c, 0, 0);
    Compare(pix3, pix1, &error);
    pixSaveTiled(pix3, pixa, 1, 0, 30, 32);
    pixDestroy(&pix1);
    pixDestroy(&pix2);
    pixDestroy(&pix3);

        /* Extraction of data when pixs is not cloned, putting
//.........這裏部分代碼省略.........
開發者ID:0xkasun,項目名稱:Dummy_Tes,代碼行數:101,代碼來源:pixmem_reg.c

示例7: Cmp_Hi

static int Cmp_Hi(const void *a, const void *b) 
{ 
	return Compare( Sort_Pts[*(int*)b], Sort_Pts[*(int*)a] ); 
} 
開發者ID:spaetzel,項目名稱:RockBlaster,代碼行數:4,代碼來源:PolygonImplementation.c

示例8: PerformSpecificTest


//.........這裏部分代碼省略.........
               {
                  pStr = NULL ;
               }

              ~PointerEnvelope( )
               {
                  delete pStr ;
               }
            } envelope ; /* struct */

            /***** Function
            STR_String * GetVariable( )
            *****/

            int  inxEnv   = -1 ;
            int  sizValue = -1 ;
            char Value[ TAL_dimBuffer ] ;

            int  numRead  = TST_pReader->ReadCommandLine( "is" ,
                      &inxEnv , &sizValue , Value ) ;

            if ( ( numRead != 2 )
              || !VerifyInxEnv( inxEnv  , YES ))
            {
               return TST_RetCodeParmError ;
            } /* if */

            envelope.pStr = vtEnv[ inxEnv ]->GetVariable( ) ;

            if ( strcmp( Value , "." ) != 0 )
            {
               if ( envelope.pStr != NULL )
               {
                  return Compare( envelope.pStr->GetLength( ) ,
                            envelope.pStr->GetString( ) , sizValue , Value ,
                            "Incorrect environment variable name" ) ;
               } /* if */
               if ( strcmp( Value , "" ) != 0 )
               {
                  return TST_RetCodeOK ;
               } /* if */
               DisplayErrorMsg( "Variable is NULL." ) ;

               return TST_RetCodeFailure ;
            } /* if */

            if ( envelope.pStr != NULL )
            {
               DisplayInformation( "Environment variable name: " ,
                         envelope.pStr->GetString( )) ;
            } else
            {
               DisplayInformation( "Variable is not set." , "" ) ;
            } /* if */

            return TST_RetCodeOK ;

         } // end selection: Test: ENV  !Get environment variable

      // Test: ENV  !Get environment string
      // AE: GetEnvironmentString  inxEnvironment   expString
      //               expString == "." displays the string
      //               expString == ""  expects NULL string

         else if ( strcmp( Command , GetString_007_CMD ) == 0 )
         {
開發者ID:mauriciogsc,項目名稱:Taliman,代碼行數:67,代碼來源:TST_ENV.CPP

示例9: return

int WebRect::Merge(WebRect *pRect1, WebRect *pRect2)
{
	return (MergeCase(pRect1, pRect2, Compare(pRect1)));
}
開發者ID:peteratebs,項目名稱:webcwebbrowser,代碼行數:4,代碼來源:webrect.cpp

示例10: Compare

bool BinaryData::operator<(const BinaryData & inData) const
{
    return Compare(inData) < 0;
}
開發者ID:afrozm,項目名稱:projects,代碼行數:4,代碼來源:BinaryFind.cpp

示例11: Compare

int cbTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2)
{
    return Compare(((FileTreeData*)GetItemData(item1))->GetProjectFile(), ((FileTreeData*)GetItemData(item2))->GetProjectFile());
}
開發者ID:WinterMute,項目名稱:codeblocks_sf,代碼行數:4,代碼來源:cbtreectrl.cpp

示例12: return

	bool CDuiString::operator >  (LPCTSTR str) const { return (Compare(str) >  0); };
開發者ID:dragonwarrior95,項目名稱:ListXml,代碼行數:1,代碼來源:Utils.cpp

示例13: main

int
main(int argc, char *argv[])
{
    const char *name = "PATH";
    char out_delim = PATHDELIM;
    int remove_duplicates = FALSE;
    size_t length = (size_t) argc;
    int operation = 'a';
    const char *where = 0;

    int c, point = 0;
    LIST *list;
    char *s;

    while ((c = getopt(argc, argv, "a:bdefn:prv")) != EOF) {
	switch (c) {
	case 'a':
	    where = optarg;
	    break;
	case 'b':
	    where = BLANK;
	    break;
	case 'd':
	    remove_duplicates = TRUE;
	    break;
	case 'e':
	    where = 0;
	    break;
	case 'f':
	    allow_files = TRUE;
	    break;
	case 'n':
	    name = optarg;
	    break;
	case 'p':
	    out_delim = ' ';
	    break;
	case 'r':
	    if (where == 0)
		where = BLANK;
	    operation = c;
	    break;
	case 'v':
	    out_delim = '\n';
	    break;
	default:
	    usage();
	}
    }

    /* Get the current path, make a corresponding list of strings.  Leave
     * enough room in the list to allow us to insert the arguments also.
     */
    if ((s = getenv(name)) == 0)
	s = StrAlloc(BLANK);
    else
	s = StrAlloc(s);	/* ...just in case someone else uses it */

    for (c = 0; s[c] != EOS; c++)
	if (s[c] == PATHDELIM)
	    length++;
    length += 3;
    list = (LIST *) calloc(length, sizeof(LIST));
    list[0].nn = StrAlloc(BLANK);	/* dummy entry, to simplify -b option */

    /* Split the environment variable into strings indexed in list[] */
    for (c = 1; *s != EOS; c++) {
	if (*s == PATHDELIM) {
	    list[c].nn = StrAlloc(".");
	} else {
	    list[c].nn = s;
	    while (*s != PATHDELIM && *s != EOS)
		s++;
	    if (*s == EOS)
		continue;
	    *s = EOS;
	}
	s++;
    }
    list[c].nn = 0;
    TRACE((stderr, "%s has %d entries\n", name, c));

    /* Find the list-entry after which we insert/remove entries */
    for (c = 0; list[c].nn != 0; c++) {
	if (where != 0 && !Compare(where, list[c].nn)) {
	    point = c;
	    break;
	}
    }
    if (list[c].nn == 0)
	point = c - 1;
    TRACE((stderr, "argc=%d, point=%d (%c)\n", argc, point, operation));

    /* Perform the actual insertion/removal */
    while (optind < argc) {
	s = argv[optind++];
	if (!Compare(s, "-"))
	    break;
	if (operation == 'r') {
	    Remove(point, list, s);
//.........這裏部分代碼省略.........
開發者ID:ThomasDickey,項目名稱:misc_tools-snapshots,代碼行數:101,代碼來源:newpath.c

示例14: Compare

bool Word::operator==(const Word &compare) const
{
  int ret = Compare(compare);
  return ret == 0;
}
開發者ID:Applied-Language-Solutions,項目名稱:mosesdecoder,代碼行數:5,代碼來源:Word.cpp

示例15: dt_RunDrawTest

bool dt_RunDrawTest(const char* from, Int_t mode = 0, Int_t verboseLevel = 0) {
  // This launch a test a TTree::Draw.
  // The mode currently available are:
  //    0: Do not load the shared library
  //    1: Load the shared library before opening the file
  //    2: Load the shared library after opening the file
  //    3: Simple TChain test with shared library
  //    4: Simple Friend test with shared library
  // The verboseLeve currently available:
  //    0: As silent as possible, only report errors and overall speed results.
  //    1: Output 0 + label for the start of each phase
  //    2: Output 1 + more details on the different phase being done
  //    3: Output 2 + stop at the first and draw a canvas showing the differences

//gDebug = 5;
   SetVerboseLevel(verboseLevel);

   if (mode == 1) {
      if (!TClassTable::GetDict("Event")) {
         gSystem->Load("Event_cxx");
     }     
      gHasLibrary = kTRUE;
   }

   TFile *hfile = 0;
   TTree *tree = 0;
   if (mode <3) {
      hfile = new TFile(from);
      tree = (TTree*)hfile->Get("T");
   }

   if (mode >= 2 && mode <= 4) {
      if (!TClassTable::GetDict("Event")) {
         gSystem->Load("Event_cxx");
      } else {
         cerr << "Since libEvent.so has already been loaded, mode 2 can not be tested!";
         cerr << endl;
      }
      gHasLibrary = kTRUE;
   }

   if (mode == 3) {
      // Test Chains.
      TChain * chain = new TChain("T");
      chain->Add(from);
      chain->Add(from);
      tree = chain;
   }

   if (mode == 4) {
      // Test friends.
      tree = new TTree("T","Base of friendship");
      tree->AddFriend("T",from);
   }

   TBranch *eb = tree->GetBranch("event");
   gBranchStyle = (int) eb->InheritsFrom(TBranchElement::Class());
   // cerr << "Branch style is " << gBranchStyle << endl;

   if (gQuietLevel<2) cout << "Generating histograms from TTree::Draw" << endl;
   TDirectory* where = GenerateDrawHist(tree,2,gQuietLevel);
 
   if (gQuietLevel<2) cout << "Comparing histograms" << endl;
   if (Compare(where)>0) {
     cout << "DrawTest: Comparison failed" << endl;
     return false;
   }
   DrawMarks();

   if (gQuietLevel<2) cout << "DrawTest: Comparison was successfull" << endl;
   if (hfile) delete hfile;
   else delete tree;
   gROOT->GetList()->Delete();

   return true;
}   
開發者ID:asmagina1995,項目名稱:roottest,代碼行數:76,代碼來源:dt_RunDrawTest.C


注:本文中的Compare函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。