您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strhash函数代码示例

51自学网 2021-06-03 08:29:47
  C++
这篇教程C++ strhash函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中strhash函数的典型用法代码示例。如果您正苦于以下问题:C++ strhash函数的具体用法?C++ strhash怎么用?C++ strhash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了strhash函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mymemberof

/* * Determine if the user is a member of 'identifier' * Returns one of: *      0       User does not match identifier *      1       identifier matches everybody *      2       User is in the group that is identifier *      3       User is identifer */static int mymemberof(const struct auth_state *auth_state,                  const char *identifier){    int i;    unsigned idhash = strhash(identifier);    static unsigned anyonehash = 0;    anyonehash = !anyonehash ? strhash("anyone") : anyonehash;    if (!auth_state) {        /* special case anonymous */        if (!strcmp(identifier, "anyone")) return 1;        else if (!strcmp(identifier, "anonymous")) return 3;        /* "anonymous" is not a member of any group */        else return 0;    }    /* is 'identifier' "anyone"? */    if (idhash == anyonehash &&        !strcmp(identifier, "anyone")) return 1;    /* is 'identifier' me? */    if (idhash == auth_state->userid.hash &&        !strcmp(identifier, auth_state->userid.id)) return 3;    /* is it a group i'm a member of ? */    for (i=0; i < auth_state->ngroups; i++)        if (idhash == auth_state->groups[i].hash &&            !strcmp(identifier, auth_state->groups[i].id))            return 2;    return 0;}
开发者ID:brong,项目名称:cyrus-imapd,代码行数:42,


示例2: dblhashRemove

int dblhashRemove(dblhash_ *h, char *key){    unsigned int code;    record_ *recs;    unsigned int off, ind, size;	ReturnErrIf(h == NULL);	ReturnErrIf(key == NULL);	code = strhash(key);    recs = h->records;    size = sizes[h->size_index];    ind = code % size;    off = 0;    while (recs[ind].hash) {        if ((code == recs[ind].hash) && (recs[ind].key != NULL)) {			if(!strcmp(key, recs[ind].key)) {				/* Do not erase hash, so probes for collisions succeed */				if((recs[ind].freeMem != 'n') && (recs[ind].key != NULL)) {					free(recs[ind].key);				}				recs[ind].key = NULL;				recs[ind].value = HUGE_VAL;				h->records_count--;				return 0;			}        }        ind = (code + (int)pow(++off, 2)) % size;    }	ReturnErr("Couldn't find %s", key);}
开发者ID:Narrat,项目名称:python3-eispice,代码行数:34,


示例3: dblhashFindPtr

int dblhashFindPtr(dblhash_ *h, char *key, double **value){    record_ *recs;    unsigned int off, ind, size;    unsigned int code;	ReturnErrIf(h == NULL);	ReturnErrIf(key == NULL);	ReturnErrIf(value == NULL);	code = strhash(key);    recs = h->records;    size = sizes[h->size_index];    ind = code % size;    off = 0;    /* search on hash which remains even if a record has been removed,     * so hash_remove() does not need to move any collision records	 */    while (recs[ind].hash) {        if ((code == recs[ind].hash) && (recs[ind].key != NULL)) {			if(!strcmp(key, recs[ind].key)) {				*value = &recs[ind].value;				return 0;			}		}        ind = (code + (int)pow(++off,2)) % size;    }    	/* Couldn't find the key */	*value = NULL;    return 0;}
开发者ID:Narrat,项目名称:python3-eispice,代码行数:34,


示例4: insert_names

/* **************************************************************** *	Insere os símbolos, enquanto n
C++ stricmp函数代码示例
C++ strftime函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。