• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ row类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: update

	void update(int x, int y, ll v) {
		int m = (s+e)/2;
		if (s == e) val->update(y, v);
		else {
			if (x > m) {
				if (r == NULL) r = new row(x, x);
				else if (!r->inrange(x)) {
					row* tmp = r;
					pi nxt = lca(s, e, r->s, r->e, x);
					r = new row(nxt.first, nxt.second);
					if (tmp->e <= (r->s + r->e)/2 ) r->l = tmp;
					else r->r = tmp;
					r->val = tmp->val->clone();
				}
				r->update(x, y, v);
			}
			else {
				if (l == NULL) l = new row(x, x);
				else if (!l->inrange(x)) {
					row* tmp = l;
					pi nxt = lca(s, e, l->s, l->e, x);
					l = new row(nxt.first, nxt.second);
					if (tmp->e <= (l->s + l->e)/2 ) l->l = tmp;
					else l->r = tmp;
					l->val = tmp->val->clone();
				}
				l->update(x, y, v);
			}
			ll rv = 0;
			if (l != NULL) rv = __gcd(l->val->query(y, y), rv);
			if (r != NULL) rv = __gcd(r->val->query(y, y), rv);
			val->update(y, rv);
		}
	}
开发者ID:ranaldmiao,项目名称:noiref,代码行数:34,代码来源:ioigame.cpp


示例2: is_cyclic_le

RINGING_USING_NAMESPACE
RINGING_USING_STD

bool is_cyclic_le( const row &lh, int hunts )
{
  const int n( lh.bells() - hunts );

  // Rounds doesn't count...
  if ( lh[hunts] == hunts ) 
    return false;

  {
    for ( int i=0; i<hunts; ++i )
      if ( lh[i] != i )
	return false;
  }

  {
    for ( int i=hunts+1; i<lh.bells(); ++i )
      if ( (lh[i] - hunts) % n != (lh[i-1] + 1 - hunts) % n )
	return false;
  }

  return true;
}
开发者ID:ogdenpm,项目名称:ringing-lib,代码行数:25,代码来源:methodutils.cpp


示例3: isspace

void
config_reader::parse_debug_line(row<long>& dbg_line, ch_string& str_ln){
#ifdef FULL_DEBUG
	bj_ostream& os = bj_out;
	MARK_USED(os);
	
	const char* pt_in = str_ln.c_str();

	dbg_line.clear();
	
	long num_ln = 0;

	if(isalnum(*pt_in)){
		skip_whitespace(pt_in, num_ln);
		while(isdigit(*pt_in) || isspace(*pt_in)){
			if(isspace(*pt_in)){
				pt_in++;
				continue;
			}
			//os << pt_in << "$\n";
			
			long val = parse_long(pt_in, num_ln); 
			//skip_whitespace(pt_in, num_ln);
	
			dbg_line.push(val);
		}
	} else {
		skip_line(pt_in, num_ln);
	}
#endif
}
开发者ID:ben-jose,项目名称:ben-jose,代码行数:31,代码来源:dbg_config.cpp


示例4: read_batch_instances

void
read_batch_instances(ch_string file_nm, row<satex_entry>& f_insts){
	bj_ostream& os = bj_out;

	std::ifstream in_stm;

	in_stm.open(file_nm.c_str(), std::ios::binary);
	if(! in_stm.good() || ! in_stm.is_open()){
		os << "NO " << file_nm << " FILE FOUND." << bj_eol;
		return;
	}

	ch_string str_ln;
	long num_ln = 0;

	f_insts.clear();

	while(! in_stm.eof()){
		std::getline(in_stm, str_ln);
		num_ln++;

		if(! str_ln.empty()){
			satex_entry& n_inst = f_insts.inc_sz();
		
			//os << "Lei:<<" << str_ln << ">>" << bj_eol;
			n_inst.parse_entry(str_ln, num_ln);
		}
	}
	in_stm.close();
}
开发者ID:ben-jose,项目名称:ben-jose,代码行数:30,代码来源:dbg_run_satex.cpp


示例5: init

            /*!
             * initializes with values from a database row
             */
            void record::init(const row &values) {
                if (!values.is_valid()) {
                    return;
                }

                for (auto v = values.begin(); v != values.end(); ++v) {
                    set(v.name(), v->value());
                }

                on_record_init(values);
            }
开发者ID:ryjen,项目名称:db,代码行数:14,代码来源:record.cpp


示例6: check_solution

row check_solution(const matrix &A , const row &X, const row &B) {
    row diff;
    diff.resize(B.size());
    int size = B.size();
    for(int i = 0; i < size; i++) {
        double temp = 0;
        for(int j = 0; j < size; j++) {
            temp += A[i][j] * X[j];
        }
        diff[i] = temp - B[i];
    }
    return diff;
}
开发者ID:minaevmike,项目名称:fedlab_pthread,代码行数:13,代码来源:main.cpp


示例7: _write_row

int table::edit_row(const row &old_row, row new_row) {
  int count = 0;
  // add column data that is not included to new_row (still enables writing empty values)
  for (int i=0;i<_Tstruct.size();i++) {
    if (!new_row.is_defined(new_row[_Tstruct[i].name])) new_row.add(_Tstruct[i], old_row[_Tstruct[i].name]);
  }
  
  if (old_row.id >= 0) {
    _fdata->seek(old_row.id*_row_size);
    _write_row(new_row._data);
    count++;
    
    // if old row's key value has changed then update the key entry (insde _keys)
    if (old_row[_key.name] != new_row[_key.name]) {
      for (int i=0;i<_keys.size();i++) {
        if (_keys[i].row_id == old_row.id) {
          _keys[i].data = new_row[_key.name]; // change key entry data to represent change
          break;
        }
      }
    }
    
  }
  else {
    query q;
    predicate p;

    for (int i=0;i<_Tstruct.size();i++) p.And( equalto(_Tstruct[i], old_row[_Tstruct[i].name]) ); // build predicate matching the row

    q.where(p);
    vector<row> results = select(q);
    for (int i=0;i<results.size();i++) {
      _fdata->seek(results[i].id * _row_size);
      _write_row(new_row._data);
      count++;
      
      // if old row's key value has changed then update the key entry (insde _keys)
      if (old_row[_key.name] != new_row[_key.name]) {
        for (int i=0;i<_keys.size();i++) {
          if (_keys[i].row_id == results[i].id) {
            _keys[i].data = new_row[_key.name]; // change key entry data to represent change
            break;
          }
        }
      }
      
    }
  }
  return count;
}
开发者ID:joshmg,项目名称:db2,代码行数:50,代码来源:table.cpp


示例8: fetch

    static bool fetch(const row& res, ColOrName col_or_name, std::unique_ptr<T>& v)
    {
        T tmp;
        if (res.fetch(col_or_name, tmp))
            v.reset(new T(std::move(tmp)));

        return true;
    }
开发者ID:shuffle-c,项目名称:edba,代码行数:8,代码来源:std_unique_ptr.hpp


示例9: delete_row

void table::delete_row(const row& del_row) {
  if (del_row.id >= 0) delete_row(del_row.id);
  else {
    predicate p;
    for (int i=0;i<_Tstruct.size();i++) if (del_row.is_defined(_Tstruct[i])) p.And( equalto(_Tstruct[i], del_row[_Tstruct[i]]) ); // build predicate matching the row
    delete_row(select(query().where(p)));
  }
}
开发者ID:joshmg,项目名称:db2,代码行数:8,代码来源:table.cpp


示例10: fetch

    static bool fetch(const row& res, ColOrName col_or_name, boost::posix_time::ptime& v)
    {
        std::tm tm_struct;
        bool ret = res.fetch(col_or_name, tm_struct);
        if (ret)
            v = boost::posix_time::ptime_from_tm(tm_struct);

        return ret;
    }
开发者ID:shuffle-c,项目名称:edba,代码行数:9,代码来源:boost_posix_time_ptime.hpp


示例11: debugEcho

    void debugEcho(const row& row_)
    {
        std::ostringstream doc;
        doc << "<row>" << std::endl;
        for(std::size_t i = 0; i != row_.size(); ++i)
        {
            const column_properties & props = row_.get_properties(i);

            doc << "   " << props.get_name();

            switch(props.get_data_type())
            {
            case dt_string:
                doc << "-string:" << row_.get<std::string>(i);
                break;
            case dt_double:
                doc << "-double:" << row_.get<double>(i);
                break;
            case dt_integer:
                doc << "-integer:" << row_.get<int>(i);
                break;
            case dt_unsigned_long:
                doc << "-ulong:" << row_.get<unsigned long>(i);
                break;
            case dt_long_long:
                doc << "-long long:" << row_.get<long long>(i);
                break;
            case dt_date:
                std::tm when = row_.get<std::tm>(i);
                doc << "-date:" << asctime(&when);
                break;
            }

            doc << std::endl;
        }
        doc << "</row>" << std::endl;

        std::cout << doc.str();
    }
开发者ID:arlukin,项目名称:avshop,代码行数:39,代码来源:AVDebug.cpp


示例12: ck_sorted_sorsets

bool	ck_sorted_sorsets(row<sorset*>& rr_srss, cmp_srs_func_t cmp_fn){
	std::ostream& os = std::cout;

	long the_sz = rr_srss.size();
	if(the_sz == 0){ return true; }
	sorset* lst = rr_srss[0];
	for(row_index ii = 1; ii < the_sz; ii++){
		sorset* srs = rr_srss[ii];
		if((*cmp_fn)(lst, srs) > 0){
			os << "ck_sorted_sorsets_FAILED_with" << std::endl;
			os << "srs_1=" << lst << std::endl; 	// prt_sorset
			os << "srs_2=" << srs << std::endl;   // prt_sorset
			return false;
		}
		lst = srs;
	}
	return true;
}
开发者ID:ben-jose,项目名称:ben-jose,代码行数:18,代码来源:test_sortor.cpp


示例13: write

void
sql::write_extrinsic_comparison(relation r, const abstract_column_sequence &lhs, const row &rhs) {
    vector<thunk> lhs_thunks;
    vector<thunk> rhs_thunks;
    lhs.for_each_column([&](const column_mapper &c) {
        lhs_thunks.push_back([&](sql &cmd) {
            cmd.write_evaluation(c);
        });

        const string placeholder = next_placeholder();
        rhs_thunks.push_back([=](sql &cmd) {
            write(placeholder);
        });
        attach_cell(*rhs.find_cell(c.name()));
    });

    write_lexicographic_comparison(r, lhs_thunks, rhs_thunks);
}
开发者ID:KieronAllsop,项目名称:quince,代码行数:18,代码来源:sql.cpp


示例14: list_scope

void
sql::write_values(
    const abstract_mapper_base &value_mapper,
    const row &data,
    optional<column_id> excluded
) {
    write(" VALUES (");
    comma_separated_list_scope list_scope(*this);
    value_mapper.for_each_persistent_column(
        [&](const persistent_column_mapper &p) {
            if (p.id() != excluded) {
                list_scope.start_item();
                write_value(*data.find_cell(p.name()));
            }
        }
    );
    write(")");
}
开发者ID:KieronAllsop,项目名称:quince,代码行数:18,代码来源:sql.cpp


示例15: solve_progon

row solve_progon(const matrix &A,const row &B) {
    row P, Q, ans;
    int N = B.size();
    P.resize(N);
    Q.resize(N);
    ans.resize(N);
    P[0] = - A[0][1] / A[0][0];
    Q[0] = B[0]/A[0][0];
    //Pr9moy xod
    for(int i = 1; i < N; i++) {
        P[i] = A[i][i + 1]/(-A[i][i] - A[i][i - 1]*P[i-1]);
        Q[i] = (A[i][i - 1] * Q[i - 1] - B[i]) / (-A[i][i] - A[i][i-1] * P[i - 1]);
    }

    //Obratniy xod
    ans[N - 1] = (A[N-1][N-2] * Q[N-2] - B[N-1]) / (-A[N-1][N-1] - A[N-1][N-2] * P[N-2]);
    for(int i = N - 2; i >= 0; --i) {
        ans[i] = P[i] * ans[i+1] + Q[i];
    }
    return ans;
}
开发者ID:minaevmike,项目名称:fedlab_pthread,代码行数:21,代码来源:main.cpp


示例16: ck_sorted_elems

bool	ck_sorted_elems(row<elem_sor*>& rr_ele, cmp_elems_func_t cmp_fn){
	std::ostream& os = std::cout;

	long the_sz = rr_ele.size();
	if(the_sz == 0){ return true; }
	elem_sor* lst = rr_ele[0];
	for(row_index ii = 1; ii < the_sz; ii++){
		elem_sor* ele = rr_ele[ii];
		if((*cmp_fn)(lst, ele) > 0){
			os << "ck_sorted_elems_FAILED_with" << std::endl;
			os << "ele_1=" << *lst << std::endl;
			os << "ele_2=" << *ele << std::endl;

			os << "ids_1=" << lst->es_ids << std::endl;
			os << "ids_2=" << ele->es_ids << std::endl;
			return false;
		}
		lst = ele;
	}
	return true;
}
开发者ID:ben-jose,项目名称:ben-jose,代码行数:21,代码来源:test_sortor.cpp


示例17: solve

row solve(const row &left,const row &mid,const row &right, int j) {
    int size = left.size();
    double pt, bt;
	row B(size);
    matrix A(size, row(size));
    for(int i = 0; i < A.size(); i++) {
        if(i - 1 >=0)
            A[i][i-1] = 1;
        A[i][i] = -2;
        if(i + 1 < A.size())
            A[i][i+1] = 1;
        if(i == 0)
            pt = 0;
        else
            pt = mid[i-1];
        if (i == A.size() - 1)
            bt = 0;
        else 
            bt = mid[i+1];
        B[i] = (-left[i] + 2 * mid[i] - right[i]) * dt /(R * C) + (pt - 2 * mid[i] + bt) + I[j][i] * dt/C;//(left[i] - 2 * mid[i] + right[i]) * (dt / (R * C) - 1) + I[j][i] * dt / C ;
    }
    row s = solve_progon(A, B);
    return s;
}
开发者ID:minaevmike,项目名称:fedlab_pthread,代码行数:24,代码来源:main.cpp


示例18: print_matrix

void print_matrix(const row &v) {
    for(int i = 0; i < v.size(); i++){ 
        std::cout << v[i] << std::endl;
    }
}
开发者ID:minaevmike,项目名称:fedlab_pthread,代码行数:5,代码来源:main.cpp


示例19: single_source_dijkstra_path_basic

void single_source_dijkstra_path_basic(Graph &G,int s,row &S,tablist &P,int* sigma,float* D)
{
    /*
       Graph G:G is the graph object
       s:s is the source vertex.
       S:S will contain the nodes in a topological order.
       P:P[w] gives the predecessors of w in the DAG rooted at s.
       sigma:sigma[t] gives the number of shortest paths from s to t.
       D:D[t] gives the distance from s to t.
    */
    float vw_dist;
    onemap_d seen;
    int* find=new int[G.len()];
    for(int i=0;i<G.len();i++)
    {
        find[i]=0;
    }
    for(int i=0;i<G.len();i++)
    {
        D[i]=numeric_limits<float>::infinity();
        sigma[i]=0;
    }
    sigma[s]=1;
    seen[s]=0.0;
    /*Create a priority queue*/
    priority_queue<Elem,vector<Elem>,dist_compare> Q;
    /*Add s to the queue*/
    Elem e1(s,s,0.0);
    Q.push(e1);
    S.reserve(G.len()+1);
    while(!Q.empty())
    {
        Elem e=Q.top();
        Q.pop();
        int v=e.node;
        if(find[v]==1)
        {    
            continue;
        }
        if(v!=s)
        {
           sigma[v]+=sigma[e.pred];
        }  
        S.push_back (v);   
        D[v]=e.dist;
        find[v]=1;
        for (vector<Edge>::iterator it = G.adj_list[v].begin(); it != G.adj_list[v].end(); ++it)
        {   
            int w=it->vertex;
            vw_dist=e.dist+ it->weight;
            if ((find[w]==0)&&((seen.find(w)==seen.end())||(vw_dist<seen[w])))
            {
                seen[w]=vw_dist;
                Q.push( Elem(v,w,vw_dist));
                sigma[w]=0;
                vector<int> new_vector(1);
                new_vector[0]=v;
                P[w]=new_vector;
            }
            else if (abs(vw_dist-seen[w])<EPSILON)    
            {
                sigma[w]+=sigma[v];
                P[w].push_back(v);
            }
                                                         
        }
    }
	delete[] find;
    return;    
}
开发者ID:aritraghosh,项目名称:Incremental-BC,代码行数:70,代码来源:Edge.cpp


示例20: runtime_error

outFileTable::outFileTable(const std::string & filename,const row & header):_fileName(filename),tableAbs(header.getDelim()){//output
//create outFileTable with this constructor ; inherits fileTable
      _columnHeaders=header;
      std::ofstream tmpOutFile;
      tmpOutFile.open(filename, std::ios::out | std::ios::app);
     if(!tmpOutFile.is_open())
        {
         throw std::runtime_error("Could not open file for writing.\n");
        }
      tmpOutFile.close();
 

}
开发者ID:guzzijones,项目名称:latlong,代码行数:13,代码来源:outFileTable.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rr_dev类代码示例发布时间:2022-05-31
下一篇:
C++ rose_rva_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap