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

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

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

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

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

示例1: _bind_methods

void PhysicsDirectSpaceState::_bind_methods() {//	ObjectTypeDB::bind_method(_MD("intersect_ray","from","to","exclude","umask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0));//	ObjectTypeDB::bind_method(_MD("intersect_shape:PhysicsShapeQueryResult","shape","xform","result_max","exclude","umask"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(Array()),DEFVAL(0));	ObjectTypeDB::bind_method(_MD("intersect_ray:Dictionary","from","to","exclude","layer_mask","type_mask"),&PhysicsDirectSpaceState::_intersect_ray,DEFVAL(Array()),DEFVAL(0x7FFFFFFF),DEFVAL(TYPE_MASK_COLLISION));	ObjectTypeDB::bind_method(_MD("intersect_shape","shape:PhysicsShapeQueryParameters","max_results"),&PhysicsDirectSpaceState::_intersect_shape,DEFVAL(32));	ObjectTypeDB::bind_method(_MD("cast_motion","shape:PhysicsShapeQueryParameters","motion"),&PhysicsDirectSpaceState::_cast_motion);	ObjectTypeDB::bind_method(_MD("collide_shape","shape:PhysicsShapeQueryParameters","max_results"),&PhysicsDirectSpaceState::_collide_shape,DEFVAL(32));	ObjectTypeDB::bind_method(_MD("get_rest_info","shape:PhysicsShapeQueryParameters"),&PhysicsDirectSpaceState::_get_rest_info);	BIND_CONSTANT( TYPE_MASK_STATIC_BODY );	BIND_CONSTANT( TYPE_MASK_KINEMATIC_BODY );	BIND_CONSTANT( TYPE_MASK_RIGID_BODY );	BIND_CONSTANT( TYPE_MASK_CHARACTER_BODY );	BIND_CONSTANT( TYPE_MASK_AREA );	BIND_CONSTANT( TYPE_MASK_COLLISION );}
开发者ID:3miu,项目名称:godot,代码行数:21,


示例2: get_global_state

Array get_global_state() { return Array(); }
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:1,


示例3: SET_FROM_STRUCT

void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_value) {#define SET_FROM_STRUCT(m_type)                                                               /	{                                                                                         /		GDMonoMarshal::M_##m_type from = MARSHALLED_OUT(m_type, p_value.operator ::m_type()); /		mono_field_set_value(p_object, mono_field, &from);                                    /	}#define SET_FROM_ARRAY(m_type)                                                                   /	{                                                                                            /		MonoArray *managed = GDMonoMarshal::m_type##_to_mono_array(p_value.operator ::m_type()); /		mono_field_set_value(p_object, mono_field, &managed);                                    /	}	switch (type.type_encoding) {		case MONO_TYPE_BOOLEAN: {			MonoBoolean val = p_value.operator bool();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_CHAR: {			int16_t val = p_value.operator unsigned short();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_I1: {			int8_t val = p_value.operator signed char();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_I2: {			int16_t val = p_value.operator signed short();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_I4: {			int32_t val = p_value.operator signed int();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_I8: {			int64_t val = p_value.operator int64_t();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_U1: {			uint8_t val = p_value.operator unsigned char();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_U2: {			uint16_t val = p_value.operator unsigned short();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_U4: {			uint32_t val = p_value.operator unsigned int();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_U8: {			uint64_t val = p_value.operator uint64_t();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_R4: {			float val = p_value.operator float();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_R8: {			double val = p_value.operator double();			mono_field_set_value(p_object, mono_field, &val);		} break;		case MONO_TYPE_STRING: {			MonoString *mono_string = GDMonoMarshal::mono_string_from_godot(p_value);			mono_field_set_value(p_object, mono_field, mono_string);		} break;		case MONO_TYPE_VALUETYPE: {			GDMonoClass *tclass = type.type_class;			if (tclass == CACHED_CLASS(Vector2)) {				SET_FROM_STRUCT(Vector2);				break;			}			if (tclass == CACHED_CLASS(Rect2)) {				SET_FROM_STRUCT(Rect2);				break;			}			if (tclass == CACHED_CLASS(Transform2D)) {				SET_FROM_STRUCT(Transform2D);				break;			}			if (tclass == CACHED_CLASS(Vector3)) {				SET_FROM_STRUCT(Vector3);				break;			}			if (tclass == CACHED_CLASS(Basis)) {				SET_FROM_STRUCT(Basis);				break;			}//.........这里部分代码省略.........
开发者ID:SaracenOne,项目名称:godot,代码行数:101,


示例4: Array

Array SpriteFrames::_get_frames() const {	return Array();}
开发者ID:brakhane,项目名称:godot,代码行数:4,


示例5: test_28

bool test_28() {	OS::get_singleton()->print("/n/nTest 28: sprintf/n");	bool success, state = true;	char output_format[] = "/tTest:/t%ls => %ls (%s)/n";	String format, output;	Array args;		// %%	format = "fish %% frog";	args.clear();	output = format.sprintf(args);	success = (output == String("fish % frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	//////// INTS	// Int	format = "fish %d frog";	args.clear();	args.push_back(5);	output = format.sprintf(args);	success = (output == String("fish 5 frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Int left padded with zeroes.	format = "fish %05d frog";	args.clear();	args.push_back(5);	output = format.sprintf(args);	success = (output == String("fish 00005 frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Int left padded with spaces.	format = "fish %5d frog";	args.clear();	args.push_back(5);	output = format.sprintf(args);	success = (output == String("fish     5 frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Int right padded with spaces.	format = "fish %-5d frog";	args.clear();	args.push_back(5);	output = format.sprintf(args);	success = (output == String("fish 5     frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Int with sign (positive).	format = "fish %+d frog";	args.clear();	args.push_back(5);	output = format.sprintf(args);	success = (output == String("fish +5 frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Negative int.	format = "fish %d frog";	args.clear();	args.push_back(-5);	output = format.sprintf(args);	success = (output == String("fish -5 frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Hex (lower)	format = "fish %x frog";	args.clear();	args.push_back(45);	output = format.sprintf(args);	success = (output == String("fish 2d frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Hex (upper)	format = "fish %X frog";	args.clear();	args.push_back(45);	output = format.sprintf(args);	success = (output == String("fish 2D frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;	// Octal	format = "fish %o frog";	args.clear();	args.push_back(99);	output = format.sprintf(args);	success = (output == String("fish 143 frog"));	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");	if (!success) state = false;//.........这里部分代码省略.........
开发者ID:Gerold31,项目名称:godot,代码行数:101,


示例6: Array

void ObjectArrayIter::next() {  m_obj->o_invoke(s_next, Array(), -1);}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:3,


示例7: hphp_context_init

bool HttpRequestHandler::executePHPRequest(Transport *transport,                                           RequestURI &reqURI,                                           SourceRootInfo &sourceRootInfo,                                           bool cachableDynamicContent) {  ExecutionContext *context = hphp_context_init();  context->setTransport(transport);  string file = reqURI.absolutePath().c_str();  {    ServerStatsHelper ssh("input");    HttpProtocol::PrepareSystemVariables(transport, reqURI, sourceRootInfo);    reqURI.clear();    sourceRootInfo.clear();  }  bool error = false;  std::string errorMsg = "Internal Server Error";  bool ret = hphp_invoke(context, file, false, Array(), null,                         RuntimeOption::WarmupDocument,                         RuntimeOption::RequestInitFunction,                         error, errorMsg);  int code;  if (ret) {    std::string content = context->getContents();    if (cachableDynamicContent && !content.empty()) {      ASSERT(transport->getUrl());      string key = file + transport->getUrl();      DynamicContentCache::TheCache.store(key, content.data(), content.size());    }    code = 200;    transport->sendRaw((void*)content.data(), content.size());  } else if (error) {    code = 500;    string errorPage = context->getErrorPage();    if (errorPage.empty()) {      errorPage = RuntimeOption::ErrorDocument500;    }    if (!errorPage.empty()) {      context->obEndAll();      context->obStart();      context->obProtect(true);      ret = hphp_invoke(context, errorPage, false, Array(), null,                        RuntimeOption::WarmupDocument,                        RuntimeOption::RequestInitFunction,                        error, errorMsg);      if (ret) {        std::string content = context->getContents();        transport->sendRaw((void*)content.data(), content.size());      } else {        errorPage.clear(); // so we fall back to 500 return      }    }    if (errorPage.empty()) {      if (RuntimeOption::ServerErrorMessage) {        transport->sendString(errorMsg, 500);      } else {        transport->sendString(RuntimeOption::FatalErrorMessage, 500);      }    }  } else {    code = 404;    transport->sendString("Not Found", 404);  }  transport->onSendEnd();  ServerStats::LogPage(file, code);  hphp_context_exit(context, true);  return ret;}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:70,


示例8: php_globals_as_array

Array php_globals_as_array() {  return Array(get_global_variables()->asArrayData());}
开发者ID:DerPapst,项目名称:hhvm,代码行数:3,


示例9: slice

Array Array::slice(int offset, int length, bool preserve_keys) const {  if (m_px == nullptr) return Array();  return ArrayUtil::Slice(m_px, offset, length, preserve_keys);}
开发者ID:524777134,项目名称:hiphop-php,代码行数:4,


示例10: Array

Array Array::operator+(ArrayData *data) const {  return Array(m_px).operator+=(data);}
开发者ID:524777134,项目名称:hiphop-php,代码行数:3,


示例11: godot_array_new_copy

void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) {	Array *dest = (Array *)r_dest;	const Array *src = (const Array *)p_src;	memnew_placement(dest, Array(*src));}
开发者ID:SaracenOne,项目名称:godot,代码行数:5,


示例12: f_icu_match

Variant f_icu_match(CStrRef pattern, CStrRef subject,                    VRefParam matches /* = null */, int64_t flags /* = 0 */) {    UErrorCode status = U_ZERO_ERROR;    if (matches.isReferenced()) {        matches = Array();    }    // Create hash map key by concatenating pattern and flags.    StringBuffer bpattern;    bpattern.append(pattern);    bpattern.append(':');    bpattern.append(flags);    String spattern = bpattern.detach();    // Find compiled pattern matcher in hash map or add it.    PatternStringMap::accessor accessor;    const RegexPattern* rpattern;    if (s_patternCacheMap.find(accessor, spattern.get())) {        rpattern = accessor->second;    } else {        // First 32 bits are reserved for ICU-specific flags.        rpattern = RegexPattern::compile(                       UnicodeString::fromUTF8(pattern.data()), (flags & 0xFFFFFFFF), status);        if (U_FAILURE(status)) {            return false;        }        if (s_patternCacheMap.insert(                    accessor, makeStaticString(spattern.get()))) {            accessor->second = rpattern;        } else {            delete rpattern;            rpattern = accessor->second;        }    }    // Build regex matcher from compiled pattern and passed-in subject.    UnicodeString usubject = UnicodeString::fromUTF8(subject.data());    boost::scoped_ptr<RegexMatcher> matcher(rpattern->matcher(usubject, status));    if (U_FAILURE(status)) {        return false;    }    // Return 0 or 1 depending on whether or not a match was found and    // (optionally), set matched (sub-)patterns for passed-in reference.    int matched = 0;    if (matcher->find()) {        matched = 1;        if (matches.isReferenced()) {            int32_t count = matcher->groupCount();            for (int32_t i = 0; i <= count; i++) {                UnicodeString ustring = matcher->group(i, status);                if (U_FAILURE(status)) {                    return false;                }                // Convert UnicodeString back to UTF-8.                std::string string;                ustring.toUTF8String(string);                String match = String(string);                if (flags & k_UREGEX_OFFSET_CAPTURE) {                    // start() returns the index in UnicodeString, which                    // normally means the index into an array of 16-bit                    // code "units" (not "points").                    int32_t start = matcher->start(i, status);                    if (U_FAILURE(status)) {                        return false;                    }                    start = usubject.countChar32(0, start);                    matches->append(make_packed_array(match, start));                } else {                    matches->append(match);                }            }        }    }    return matched;}
开发者ID:raviagarwal292,项目名称:hiphop-php,代码行数:84,


示例13: time

bool RPCRequestHandler::executePHPFunction(Transport *transport,                                           SourceRootInfo &sourceRootInfo) {  // reset timeout counter  ThreadInfo::s_threadInfo->m_reqInjectionData.started = time(0);  string rpcFunc = transport->getCommand();  {    ServerStatsHelper ssh("input");    RequestURI reqURI(rpcFunc);    HttpProtocol::PrepareSystemVariables(transport, reqURI, sourceRootInfo);  }  bool isFile = rpcFunc.rfind('.') != string::npos;  string rpcFile;  bool error = false;  Array params;  string sparams = transport->getParam("params");  if (!sparams.empty()) {    Variant jparams = f_json_decode(String(sparams), true);    if (jparams.isArray()) {      params = jparams.toArray();    } else {      error = true;    }  } else {    vector<string> sparams;    transport->getArrayParam("p", sparams);    if (!sparams.empty()) {      for (unsigned int i = 0; i < sparams.size(); i++) {        Variant jparams = f_json_decode(String(sparams[i]), true);        if (same(jparams, false)) {          error = true;          break;        }        params.append(jparams);      }    } else {      // single string parameter, used by xbox to avoid any en/decoding      int size;      const void *data = transport->getPostData(size);      if (data && size) {        params.append(String((char*)data, size, AttachLiteral));      }    }  }  if (transport->getIntParam("reset") == 1) {    m_reset = true;  }  int output = transport->getIntParam("output");  int code;  if (!error) {    Variant funcRet;    string errorMsg = "Internal Server Error";    string warmupDoc, reqInitFunc, reqInitDoc;    if (m_serverInfo) {      warmupDoc = m_serverInfo->getWarmupDoc();      reqInitFunc = m_serverInfo->getReqInitFunc();      reqInitDoc = m_serverInfo->getReqInitDoc();    }    if (!warmupDoc.empty()) warmupDoc = canonicalize_path(warmupDoc, "", 0);    if (!warmupDoc.empty()) {      warmupDoc = getSourceFilename(warmupDoc, sourceRootInfo);    }    if (!reqInitDoc.empty()) reqInitDoc = canonicalize_path(reqInitDoc, "", 0);    if (!reqInitDoc.empty()) {        reqInitDoc = getSourceFilename(reqInitDoc, sourceRootInfo);    }    bool runOnce = false;    bool ret = true;    if (isFile) {      rpcFile = rpcFunc;      rpcFunc.clear();    } else {      rpcFile = transport->getParam("include");      if (rpcFile.empty()) {        rpcFile = transport->getParam("include_once");        runOnce = true;      }    }    if (!rpcFile.empty()) {      // invoking a file through rpc      bool forbidden = false;      if (!RuntimeOption::ForbiddenFileExtensions.empty()) {        const char *ext = rpcFile.c_str() + rpcFile.rfind('.') + 1;        if (RuntimeOption::ForbiddenFileExtensions.find(ext) !=            RuntimeOption::ForbiddenFileExtensions.end()) {          forbidden = true;        }      }      if (!forbidden) {        rpcFile = canonicalize_path(rpcFile, "", 0);        rpcFile = getSourceFilename(rpcFile, sourceRootInfo);        ret = hphp_invoke(m_context, rpcFile, false, Array(), null,                          warmupDoc, reqInitFunc, reqInitDoc,                          error, errorMsg, runOnce);//.........这里部分代码省略.........
开发者ID:Jostein,项目名称:hiphop-php,代码行数:101,


示例14: readLine

Array File::readCSV(int64 length /* = 0 */, char delimiter_char /* = ',' */,                    char enclosure_char /* = '"' */) {  String line = readLine(length);  if (line.empty()) {    return Array();  }  String new_line;  const char *buf = line.data();  int64 buf_len = line.size();  char *temp, *tptr, *line_end, *limit;  const char *bptr;  const char escape_char = '//';  int64 temp_len, line_end_len;  bool first_field = true;  /* Now into new section that parses buf for delimiter/enclosure fields */  /* Strip trailing space from buf, saving end of line in case required     for enclosure field */  bptr = buf;  tptr = (char *)lookup_trailing_spaces(buf, buf_len);  line_end_len = buf_len - (size_t)(tptr - buf);  line_end = limit = tptr;  /* reserve workspace for building each individual field */  temp_len = buf_len;  temp = (char *)malloc(temp_len + line_end_len + 1);  /* Initialize return array */  Array ret;  /* Main loop to read CSV fields */  /* NB this routine will return a single null entry for a blank line */  do {    char *comp_end;    const char *hunk_begin;    tptr = temp;    /* 1. Strip any leading space */    for (; bptr < limit; ++bptr) {      if (!isspace((int)*(unsigned char *)bptr) || *bptr == delimiter_char) {        break;      }    }    if (first_field && bptr == line_end) {      ret.append(null_variant);      break;    }    first_field = false;    /* 2. Read field, leaving bptr pointing at start of next field */    if (bptr < limit && *bptr == enclosure_char) {      int state = 0;      bptr++;  /* move on to first character in field */      hunk_begin = bptr;      /* 2A. handle enclosure delimited field */      int inc_len = 1;      for (;;) {        switch (inc_len) {        case 0:          switch (state) {          case 2:            memcpy(tptr, hunk_begin, bptr - hunk_begin - 1);            tptr += (bptr - hunk_begin - 1);            hunk_begin = bptr;            goto quit_loop_2;          case 1:            memcpy(tptr, hunk_begin, bptr - hunk_begin);            tptr += (bptr - hunk_begin);            hunk_begin = bptr;            /* break is omitted intentionally */          case 0:            {              if (hunk_begin != line_end) {                memcpy(tptr, hunk_begin, bptr - hunk_begin);                tptr += (bptr - hunk_begin);                hunk_begin = bptr;              }              /* add the embedded line end to the field */              memcpy(tptr, line_end, line_end_len);              tptr += line_end_len;              new_line = readLine(length);              const char *new_buf = new_line.data();              int64 new_len = new_line.size();              if (new_len == 0) {                /* we've got an unterminated enclosure,                 * assign all the data from the start of                 * the enclosure to end of data to the                 * last element */                if ((size_t)temp_len > (size_t)(limit - buf)) {//.........这里部分代码省略.........
开发者ID:deivisonarthur,项目名称:hiphop-php,代码行数:101,


示例15: Array

 void DiscretizedVanillaOption::reset(Size size) {     values_ = Array(size, 0.0);     adjustValues(); }
开发者ID:21hub,项目名称:QuantLib,代码行数:4,


示例16: Array

Array Object::_get_signal_list() const{	return Array();}
开发者ID:AMG194,项目名称:godot,代码行数:4,


示例17: x

    EndCriteria::Type Simplex::minimize(Problem& P,                                        const EndCriteria& endCriteria) {        // set up of the problem        //Real ftol = endCriteria.functionEpsilon();    // end criteria on f(x) (see Numerical Recipes in C++, p.410)        Real xtol = endCriteria.rootEpsilon();          // end criteria on x (see GSL v. 1.9, http://www.gnu.org/software/gsl/)        Size maxStationaryStateIterations_            = endCriteria.maxStationaryStateIterations();        EndCriteria::Type ecType = EndCriteria::None;        P.reset();        Array x_ = P.currentValue();        Integer iterationNumber_=0;        // Initialize vertices of the simplex        Size n = x_.size(), i;        vertices_ = std::vector<Array>(n+1, x_);        for (i=0; i<n; i++) {            Array direction(n, 0.0);            direction[i] = 1.0;            P.constraint().update(vertices_[i+1], direction, lambda_);        }        // Initialize function values at the vertices of the simplex        values_ = Array(n+1, 0.0);        for (i=0; i<=n; i++)            values_[i] = P.value(vertices_[i]);        // Loop looking for minimum        do {            sum_ = Array(n, 0.0);            Size i;            for (i=0; i<=n; i++)                sum_ += vertices_[i];            // Determine the best (iLowest), worst (iHighest)            // and 2nd worst (iNextHighest) vertices            Size iLowest = 0;            Size iHighest, iNextHighest;            if (values_[0]<values_[1]) {                iHighest = 1;                iNextHighest = 0;            } else {                iHighest = 0;                iNextHighest = 1;            }            for (i=1;i<=n; i++) {                if (values_[i]>values_[iHighest]) {                    iNextHighest = iHighest;                    iHighest = i;                } else {                    if ((values_[i]>values_[iNextHighest]) && i!=iHighest)                        iNextHighest = i;                }                if (values_[i]<values_[iLowest])                    iLowest = i;            }            // Now compute accuracy, update iteration number and check end criteria            //// Numerical Recipes exit strategy on fx (see NR in C++, p.410)            //Real low = values_[iLowest];            //Real high = values_[iHighest];            //Real rtol = 2.0*std::fabs(high - low)/            //    (std::fabs(high) + std::fabs(low) + QL_EPSILON);            //++iterationNumber_;            //if (rtol < ftol ||            //    endCriteria.checkMaxIterations(iterationNumber_, ecType)) {            // GSL exit strategy on x (see GSL v. 1.9, http://www.gnu.org/software/gsl            Real simplexSize = computeSimplexSize(vertices_);            ++iterationNumber_;            if (simplexSize < xtol ||                endCriteria.checkMaxIterations(iterationNumber_, ecType)) {                endCriteria.checkStationaryPoint(0.0, 0.0,                    maxStationaryStateIterations_, ecType);                endCriteria.checkMaxIterations(iterationNumber_, ecType);                x_ = vertices_[iLowest];                Real low = values_[iLowest];                P.setFunctionValue(low);                P.setCurrentValue(x_);                return ecType;            }            // If end criteria is not met, continue            Real factor = -1.0;            Real vTry = extrapolate(P, iHighest, factor);            if ((vTry <= values_[iLowest]) && (factor == -1.0)) {                factor = 2.0;                extrapolate(P, iHighest, factor);            } else if (std::fabs(factor) > QL_EPSILON) {                if (vTry >= values_[iNextHighest]) {                    Real vSave = values_[iHighest];                    factor = 0.5;                    vTry = extrapolate(P, iHighest, factor);                    if (vTry >= vSave && std::fabs(factor) > QL_EPSILON) {                        for (Size i=0; i<=n; i++) {                            if (i!=iLowest) {                                #if defined(QL_ARRAY_EXPRESSIONS)                                vertices_[i] =                                    0.5*(vertices_[i] + vertices_[iLowest]);                                #else                                vertices_[i] += vertices_[iLowest];                                vertices_[i] *= 0.5;                                #endif                                values_[i] = P.value(vertices_[i]);                            }                        }                    }//.........这里部分代码省略.........
开发者ID:BGC-nglass,项目名称:quantlib,代码行数:101,


示例18: INSTANCE_METHOD_INJECTION_BUILTIN

void c_Continuation::t_rewind() {  INSTANCE_METHOD_INJECTION_BUILTIN(Continuation, Continuation::rewind);  this->o_invoke(s_next, Array());}
开发者ID:CoolCloud,项目名称:hiphop-php,代码行数:4,


示例19: Array

Array ExtendedException::getBacktrace() const {  return Array(m_btp.get());}
开发者ID:mahanhaz,项目名称:hhvm,代码行数:3,


示例20: get_global_array_wrapper

Array get_global_array_wrapper() {  return Array();}
开发者ID:AviMoto,项目名称:hiphop-php,代码行数:3,


示例21: _bind_methods

void CanvasItem::_bind_methods() {	ObjectTypeDB::bind_method(_MD("_sort_children"),&CanvasItem::_sort_children);	ObjectTypeDB::bind_method(_MD("_raise_self"),&CanvasItem::_raise_self);	ObjectTypeDB::bind_method(_MD("_update_callback"),&CanvasItem::_update_callback);	ObjectTypeDB::bind_method(_MD("_set_visible_"),&CanvasItem::_set_visible_);	ObjectTypeDB::bind_method(_MD("_is_visible_"),&CanvasItem::_is_visible_);	ObjectTypeDB::bind_method(_MD("edit_set_state","state"),&CanvasItem::edit_set_state);	ObjectTypeDB::bind_method(_MD("edit_get"),&CanvasItem::edit_get_state);	ObjectTypeDB::bind_method(_MD("edit_set_rect","rect"),&CanvasItem::edit_set_rect);	ObjectTypeDB::bind_method(_MD("edit_rotate","degrees"),&CanvasItem::edit_rotate);	ObjectTypeDB::bind_method(_MD("get_item_rect"),&CanvasItem::get_item_rect);	//ObjectTypeDB::bind_method(_MD("get_transform"),&CanvasItem::get_transform);	ObjectTypeDB::bind_method(_MD("get_canvas_item"),&CanvasItem::get_canvas_item);	ObjectTypeDB::bind_method(_MD("is_visible"),&CanvasItem::is_visible);	ObjectTypeDB::bind_method(_MD("is_hidden"),&CanvasItem::is_hidden);	ObjectTypeDB::bind_method(_MD("show"),&CanvasItem::show);	ObjectTypeDB::bind_method(_MD("hide"),&CanvasItem::hide);	ObjectTypeDB::bind_method(_MD("update"),&CanvasItem::update);	ObjectTypeDB::bind_method(_MD("set_as_toplevel","enable"),&CanvasItem::set_as_toplevel);	ObjectTypeDB::bind_method(_MD("is_set_as_toplevel"),&CanvasItem::is_set_as_toplevel);	ObjectTypeDB::bind_method(_MD("set_blend_mode","blend_mode"),&CanvasItem::set_blend_mode);	ObjectTypeDB::bind_method(_MD("get_blend_mode"),&CanvasItem::get_blend_mode);	ObjectTypeDB::bind_method(_MD("set_light_mask","light_mask"),&CanvasItem::set_light_mask);	ObjectTypeDB::bind_method(_MD("get_light_mask"),&CanvasItem::get_light_mask);	ObjectTypeDB::bind_method(_MD("set_opacity","opacity"),&CanvasItem::set_opacity);	ObjectTypeDB::bind_method(_MD("get_opacity"),&CanvasItem::get_opacity);	ObjectTypeDB::bind_method(_MD("set_self_opacity","self_opacity"),&CanvasItem::set_self_opacity);	ObjectTypeDB::bind_method(_MD("get_self_opacity"),&CanvasItem::get_self_opacity);	ObjectTypeDB::bind_method(_MD("set_draw_behind_parent","enable"),&CanvasItem::set_draw_behind_parent);	ObjectTypeDB::bind_method(_MD("is_draw_behind_parent_enabled"),&CanvasItem::is_draw_behind_parent_enabled);	ObjectTypeDB::bind_method(_MD("_set_on_top","on_top"),&CanvasItem::_set_on_top);	ObjectTypeDB::bind_method(_MD("_is_on_top"),&CanvasItem::_is_on_top);	//ObjectTypeDB::bind_method(_MD("get_transform"),&CanvasItem::get_transform);	ObjectTypeDB::bind_method(_MD("draw_line","from","to","color","width"),&CanvasItem::draw_line,DEFVAL(1.0));	ObjectTypeDB::bind_method(_MD("draw_rect","rect","color"),&CanvasItem::draw_rect);	ObjectTypeDB::bind_method(_MD("draw_circle","pos","radius","color"),&CanvasItem::draw_circle);	ObjectTypeDB::bind_method(_MD("draw_texture","texture:Texture","pos"),&CanvasItem::draw_texture);	ObjectTypeDB::bind_method(_MD("draw_texture_rect","texture:Texture","rect","tile","modulate"),&CanvasItem::draw_texture_rect,DEFVAL(false),DEFVAL(Color(1,1,1)));	ObjectTypeDB::bind_method(_MD("draw_texture_rect_region","texture:Texture","rect","src_rect","modulate"),&CanvasItem::draw_texture_rect_region,DEFVAL(Color(1,1,1)));	ObjectTypeDB::bind_method(_MD("draw_style_box","style_box:StyleBox","rect"),&CanvasItem::draw_style_box);	ObjectTypeDB::bind_method(_MD("draw_primitive","points","colors","uvs","texture:Texture","width"),&CanvasItem::draw_primitive,DEFVAL(Array()),DEFVAL(Ref<Texture>()),DEFVAL(1.0));	ObjectTypeDB::bind_method(_MD("draw_polygon","points","colors","uvs","texture:Texture"),&CanvasItem::draw_polygon,DEFVAL(Array()),DEFVAL(Ref<Texture>()));	ObjectTypeDB::bind_method(_MD("draw_colored_polygon","points","color","uvs","texture:Texture"),&CanvasItem::draw_colored_polygon,DEFVAL(Array()),DEFVAL(Ref<Texture>()));	ObjectTypeDB::bind_method(_MD("draw_string","font:Font","pos","text","modulate","clip_w"),&CanvasItem::draw_string,DEFVAL(Color(1,1,1)),DEFVAL(-1));	ObjectTypeDB::bind_method(_MD("draw_char","font:Font","pos","char","next","modulate"),&CanvasItem::draw_char,DEFVAL(Color(1,1,1)));	ObjectTypeDB::bind_method(_MD("draw_set_transform","pos","rot","scale"),&CanvasItem::draw_set_transform);	ObjectTypeDB::bind_method(_MD("get_transform"),&CanvasItem::get_transform);	ObjectTypeDB::bind_method(_MD("get_global_transform"),&CanvasItem::get_global_transform);	ObjectTypeDB::bind_method(_MD("get_global_transform_with_canvas"),&CanvasItem::get_global_transform_with_canvas);	ObjectTypeDB::bind_method(_MD("get_viewport_transform"),&CanvasItem::get_viewport_transform);	ObjectTypeDB::bind_method(_MD("get_viewport_rect"),&CanvasItem::get_viewport_rect);	ObjectTypeDB::bind_method(_MD("get_canvas_transform"),&CanvasItem::get_canvas_transform);	ObjectTypeDB::bind_method(_MD("get_local_mouse_pos"),&CanvasItem::get_local_mouse_pos);	ObjectTypeDB::bind_method(_MD("get_global_mouse_pos"),&CanvasItem::get_global_mouse_pos);	ObjectTypeDB::bind_method(_MD("get_canvas"),&CanvasItem::get_canvas);	ObjectTypeDB::bind_method(_MD("get_world_2d"),&CanvasItem::get_world_2d);	//ObjectTypeDB::bind_method(_MD("get_viewport"),&CanvasItem::get_viewport);	ObjectTypeDB::bind_method(_MD("set_material","material:CanvasItemMaterial"),&CanvasItem::set_material);	ObjectTypeDB::bind_method(_MD("get_material:CanvasItemMaterial"),&CanvasItem::get_material);	ObjectTypeDB::bind_method(_MD("set_use_parent_material","enable"),&CanvasItem::set_use_parent_material);	ObjectTypeDB::bind_method(_MD("get_use_parent_material"),&CanvasItem::get_use_parent_material);	ObjectTypeDB::bind_method(_MD("make_input_local","event"),&CanvasItem::make_input_local);	BIND_VMETHOD(MethodInfo("_draw"));	ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/visible"), _SCS("_set_visible_"),_SCS("_is_visible_") );	ADD_PROPERTY( PropertyInfo(Variant::REAL,"visibility/opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_opacity"),_SCS("get_opacity") );	ADD_PROPERTY( PropertyInfo(Variant::REAL,"visibility/self_opacity",PROPERTY_HINT_RANGE, "0,1,0.01"), _SCS("set_self_opacity"),_SCS("get_self_opacity") );	ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"visibility/behind_parent"), _SCS("set_draw_behind_parent"),_SCS("is_draw_behind_parent_enabled") );	ADD_PROPERTY( PropertyInfo(Variant::BOOL,"visibility/on_top",PROPERTY_HINT_NONE,"",0), _SCS("_set_on_top"),_SCS("_is_on_top") ); //compatibility	ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"visibility/blend_mode",PROPERTY_HINT_ENUM, "Mix,Add,Sub,Mul,PMAlpha"), _SCS("set_blend_mode"),_SCS("get_blend_mode") );	ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"visibility/light_mask",PROPERTY_HINT_ALL_FLAGS), _SCS("set_light_mask"),_SCS("get_light_mask") );	ADD_PROPERTYNZ( PropertyInfo(Variant::OBJECT,"material/material",PROPERTY_HINT_RESOURCE_TYPE, "CanvasItemMaterial"), _SCS("set_material"),_SCS("get_material") );	ADD_PROPERTYNZ( PropertyInfo(Variant::BOOL,"material/use_parent"), _SCS("set_use_parent_material"),_SCS("get_use_parent_material") );	//exporting these two things doesn't really make much sense i think	//ADD_PROPERTY( PropertyInfo(Variant::BOOL,"transform/toplevel"), _SCS("set_as_toplevel"),_SCS("is_set_as_toplevel") );	//ADD_PROPERTY(PropertyInfo(Variant::BOOL,"transform/notify"),_SCS("set_transform_notify"),_SCS("is_transform_notify_enabled"));	ADD_SIGNAL( MethodInfo("draw") );	ADD_SIGNAL( MethodInfo("visibility_changed") );	ADD_SIGNAL( MethodInfo("hide") );	ADD_SIGNAL( MethodInfo("item_rect_changed") );//.........这里部分代码省略.........
开发者ID:AMG194,项目名称:godot,代码行数:101,


示例22: prices

    template <class PathType> inline    void LongstaffSchwartzPathPricer<PathType>::calibrate() {        const Size n = paths_.size();        Array prices(n), exercise(n);        std::vector<StateType> p_state(n);        std::vector<Real> p_price(n), p_exercise(n);        for (Size i=0; i<n; ++i) {            p_state[i] = pathPricer_->state(paths_[i],len_-1);            prices[i] = p_price[i] = (*pathPricer_)(paths_[i], len_-1);            p_exercise[i] = prices[i];        }        post_processing(len_ - 1, p_state, p_price, p_exercise);        std::vector<Real>      y;        std::vector<StateType> x;        for (Size i=len_-2; i>0; --i) {            y.clear();            x.clear();            //roll back step            for (Size j=0; j<n; ++j) {                exercise[j]=(*pathPricer_)(paths_[j], i);                if (exercise[j]>0.0) {                    x.push_back(pathPricer_->state(paths_[j], i));                    y.push_back(dF_[i]*prices[j]);                }            }            if (v_.size() <=  x.size()) {                coeff_[i-1] = GeneralLinearLeastSquares(x, y, v_).coefficients();            }            else {            // if number of itm paths is smaller then the number of            // calibration functions then early exercise if exerciseValue > 0                coeff_[i-1] = Array(v_.size(), 0.0);            }            for (Size j=0, k=0; j<n; ++j) {                prices[j]*=dF_[i];                if (exercise[j]>0.0) {                    Real continuationValue = 0.0;                    for (Size l=0; l<v_.size(); ++l) {                        continuationValue += coeff_[i-1][l] * v_[l](x[k]);                    }                    if (continuationValue < exercise[j]) {                        prices[j] = exercise[j];                    }                    ++k;                }                p_state[j] = pathPricer_->state(paths_[j],i);                p_price[j] = prices[j];                p_exercise[j] = exercise[j];            }            post_processing(i, p_state, p_price, p_exercise);        }        // remove calibration paths and release memory        std::vector<PathType> empty;        paths_.swap(empty);        // entering the calculation phase        calibrationPhase_ = false;    }
开发者ID:21hub,项目名称:QuantLib,代码行数:65,


示例23: PropertyInfo

void Object::_bind_methods() {	ObjectTypeDB::bind_method(_MD("get_type"),&Object::get_type);	ObjectTypeDB::bind_method(_MD("is_type","type"),&Object::is_type);	ObjectTypeDB::bind_method(_MD("set","property","value"),&Object::_set_bind);	ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind);	ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind);	ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind);	ObjectTypeDB::bind_method(_MD("notification","what","reversed"),&Object::notification,DEFVAL(false));	ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID);	ObjectTypeDB::bind_method(_MD("set_script","script:Script"),&Object::set_script);	ObjectTypeDB::bind_method(_MD("get_script:Script"),&Object::get_script);	ObjectTypeDB::bind_method(_MD("set_meta","name","value"),&Object::set_meta);	ObjectTypeDB::bind_method(_MD("get_meta","name","value"),&Object::get_meta);	ObjectTypeDB::bind_method(_MD("has_meta","name"),&Object::has_meta);	ObjectTypeDB::bind_method(_MD("get_meta_list"),&Object::_get_meta_list_bind);	//todo reimplement this per language so all 5 arguments can be called//	ObjectTypeDB::bind_method(_MD("call","method","arg1","arg2","arg3","arg4"),&Object::_call_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()));//	ObjectTypeDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()));	ObjectTypeDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array()));	ObjectTypeDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal);//	ObjectTypeDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array()));	{		MethodInfo mi;		mi.name="emit_signal";		mi.arguments.push_back( PropertyInfo( Variant::STRING, "signal"));		ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"emit_signal",&Object::_emit_signal,mi);	}	{		MethodInfo mi;		mi.name="call";		mi.arguments.push_back( PropertyInfo( Variant::STRING, "method"));		ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call:Variant",&Object::_call_bind,mi);	}	{		MethodInfo mi;		mi.name="call_deferred";		mi.arguments.push_back( PropertyInfo( Variant::STRING, "method"));		ObjectTypeDB::bind_vararg_method(METHOD_FLAGS_DEFAULT,"call_deferred",&Object::_call_deferred_bind,mi);	}	ObjectTypeDB::bind_method(_MD("callv:Variant","method","arg_array"),&Object::callv);	ObjectTypeDB::bind_method(_MD("has_method","method"),&Object::has_method);	ObjectTypeDB::bind_method(_MD("get_signal_list"),&Object::_get_signal_list);	ObjectTypeDB::bind_method(_MD("get_signal_connection_list","signal"),&Object::_get_signal_connection_list);	ObjectTypeDB::bind_method(_MD("connect","signal","target:Object","method","binds","flags"),&Object::connect,DEFVAL(Array()),DEFVAL(0));	ObjectTypeDB::bind_method(_MD("disconnect","signal","target:Object","method"),&Object::disconnect);	ObjectTypeDB::bind_method(_MD("is_connected","signal","target:Object","method"),&Object::is_connected);	ObjectTypeDB::bind_method(_MD("set_block_signals","enable"),&Object::set_block_signals);	ObjectTypeDB::bind_method(_MD("is_blocking_signals"),&Object::is_blocking_signals);	ObjectTypeDB::bind_method(_MD("set_message_translation","enable"),&Object::set_message_translation);	ObjectTypeDB::bind_method(_MD("can_translate_messages"),&Object::can_translate_messages);	ObjectTypeDB::bind_method(_MD("property_list_changed_notify"),&Object::property_list_changed_notify);	ObjectTypeDB::bind_method(_MD("XL_MESSAGE","message"),&Object::XL_MESSAGE);	ObjectTypeDB::bind_method(_MD("tr","message"),&Object::tr);	ObjectTypeDB::bind_method(_MD("is_queued_for_deletion"),&Object::is_queued_for_deletion);	ObjectTypeDB::add_virtual_method("Object",MethodInfo("free"),false);	ADD_SIGNAL( MethodInfo("script_changed"));	BIND_VMETHOD( MethodInfo("_notification",PropertyInfo(Variant::INT,"what")) );	BIND_VMETHOD( MethodInfo("_set",PropertyInfo(Variant::STRING,"property"),PropertyInfo(Variant::NIL,"value")) );#ifdef TOOLS_ENABLED	MethodInfo miget("_get",PropertyInfo(Variant::STRING,"property") );	miget.return_val.name="var";	BIND_VMETHOD( miget );	MethodInfo plget("_get_property_list");	plget.return_val.type=Variant::ARRAY;	BIND_VMETHOD( plget );#endif	BIND_VMETHOD( MethodInfo("_init") );	BIND_CONSTANT( NOTIFICATION_POSTINITIALIZE );	BIND_CONSTANT( NOTIFICATION_PREDELETE );//.........这里部分代码省略.........
开发者ID:Brickcaster,项目名称:godot,代码行数:101,


示例24: Array

Array Object::toArray() const {  return m_px ? m_px->o_toArray() : Array();}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:3,


示例25: clear

//.........这里部分代码省略.........					_data._aabb = memnew( AABB( *p_variant._data._aabb ) );		} break;		case QUAT: {					memnew_placement( _data._mem, Quat( *reinterpret_cast<const Quat*>(p_variant._data._mem) ) );				} break;		case MATRIX3: {					_data._matrix3 = memnew( Matrix3( *p_variant._data._matrix3 ) );				} break;		case TRANSFORM: {					_data._transform = memnew( Transform( *p_variant._data._transform ) );				} break;				// misc types				case COLOR: {					memnew_placement( _data._mem, Color( *reinterpret_cast<const Color*>(p_variant._data._mem) ) );				} break;		case IMAGE: {					_data._image = memnew( Image( *p_variant._data._image ) );				} break;		case _RID: {					memnew_placement( _data._mem, RID( *reinterpret_cast<const RID*>(p_variant._data._mem) ) );		} break;		case OBJECT: {					memnew_placement( _data._mem, ObjData( p_variant._get_obj() ) );		} break;		case NODE_PATH: {					memnew_placement( _data._mem, NodePath( *reinterpret_cast<const NodePath*>(p_variant._data._mem) ) );				} break;		case INPUT_EVENT: {						_data._input_event= memnew( InputEvent( *p_variant._data._input_event ) );					} break;		case DICTIONARY: {						memnew_placement( _data._mem, Dictionary( *reinterpret_cast<const Dictionary*>(p_variant._data._mem) ) );					} break;		case ARRAY: {						memnew_placement( _data._mem, Array ( *reinterpret_cast<const Array*>(p_variant._data._mem) ) );					} break;				// arrays		case RAW_ARRAY: {					memnew_placement( _data._mem, DVector<uint8_t> ( *reinterpret_cast<const DVector<uint8_t>*>(p_variant._data._mem) ) );				} break;		case INT_ARRAY: {					memnew_placement( _data._mem, DVector<int> ( *reinterpret_cast<const DVector<int>*>(p_variant._data._mem) ) );				} break;		case REAL_ARRAY: {					memnew_placement( _data._mem, DVector<real_t> ( *reinterpret_cast<const DVector<real_t>*>(p_variant._data._mem) ) );				} break;		case STRING_ARRAY: {					memnew_placement( _data._mem, DVector<String> ( *reinterpret_cast<const DVector<String>*>(p_variant._data._mem) ) );				} break;		case VECTOR2_ARRAY: {			memnew_placement( _data._mem, DVector<Vector2> ( *reinterpret_cast<const DVector<Vector2>*>(p_variant._data._mem) ) );		} break;		case VECTOR3_ARRAY: {					memnew_placement( _data._mem, DVector<Vector3> ( *reinterpret_cast<const DVector<Vector3>*>(p_variant._data._mem) ) );				} break;		case COLOR_ARRAY: {					memnew_placement( _data._mem, DVector<Color> ( *reinterpret_cast<const DVector<Color>*>(p_variant._data._mem) ) );				} break;		default: {}	}		}
开发者ID:kyoconan,项目名称:godot,代码行数:101,



注:本文中的Array函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ArrayGetNItems函数代码示例
C++ ArgumentException函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。