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

C++ table类代码示例

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

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



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

示例1: require_valid_table

static void require_valid_table(const mesh& Mesh, const string_t& Name, const table& Table)
{
	if(Name == "constant" && Table.column_count() && Table.row_count() != 1)
		throw std::runtime_error("'constant' table must have length 1.");

	for(mesh::table_t::const_iterator array_iterator = Table.begin(); array_iterator != Table.end(); ++array_iterator)
	{
		const array* const current_array = array_iterator->second.get();
		if(!current_array)
			throw std::runtime_error("NULL table array.");

		const array* const first_array = Table.begin()->second.get();
		if(current_array->size() != first_array->size())
			throw std::runtime_error("Array length mismatch for table [" + Name + "]");

		if(current_array->get_metadata_value(metadata::key::domain()) == metadata::value::point_indices_domain())
		{
			if(!Mesh.points)
				throw std::runtime_error("Mesh missing points array.");
			
			if(!Mesh.point_selection)
				throw std::runtime_error("Mesh missing point selections array.");

			require_valid_points(Mesh);

			const mesh::indices_t* const indices = dynamic_cast<const mesh::indices_t*>(current_array);
			if(!indices)
				throw std::runtime_error("Point indices array must be an index type.");

			const mesh::indices_t::const_iterator max = std::max_element(indices->begin(), indices->end());
			if(max != indices->end() && *max >= Mesh.points->size())
				throw std::runtime_error("Point indices array out-of-bounds.");
		}
	}
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:35,代码来源:primitive_validation.cpp


示例2: add_gradient

 /**
  * Adds the gradient of the expected log-likelihood of the specified
  * data point to the gradient table g.
  *
  * \param phead the distribution over a leading set of indices of f
  * \param tail a fixed assignment to the remaining indices of f
  * \param w the weight of the data point
  */
 void add_gradient(const table<T>& phead, const uint_vector& tail, T w,
                   table<T>& g) const {
   assert(phead.arity() + tail.size() == g.arity());
   std::size_t index = g.offset().linear(tail, phead.arity());
   for (std::size_t i = 0; i < phead.size(); ++i) {
     g[index + i] += phead[i] * w;
   }
 }
开发者ID:chongbingbao,项目名称:libgm,代码行数:16,代码来源:canonical_table_ll.hpp


示例3: do_save_as_text_file

// Save the given table in a text file with its number as name, return the name
// of this file.
std::string do_save_as_text_file(table const& t)
{
    std::ostringstream oss;
    oss << t.number() << ".txt";
    std::string const filename = oss.str();
    t.save_as_text(filename);
    return filename;
}
开发者ID:vadz,项目名称:lmi.new,代码行数:10,代码来源:rate_table_tool.cpp


示例4: merge

    void table::merge(const table& src)
    {
        // if two tables are merged, the const of a const_column no longer
        // applies.
        std::map<std::string, column_ptr> converted_columns;
        for(auto& my_kv : m_columns)
        {
            if(my_kv.second->is_constant())
            {
                converted_columns.insert(
                    std::pair<std::string, column_ptr>(my_kv.first,
                        column_ptr(new nonconst_column(my_kv.second))));
            }
        }

        for(auto& converted_column : converted_columns)
        {
            m_columns.erase(converted_column.first);
            m_columns.insert(std::pair<std::string, column_ptr>(
                converted_column.first, converted_column.second));
        }

        for(uint32_t i = 0; i < src.rows(); ++i)
        {
            add_row();
            for(const auto& kv : src.m_columns)
            {
                auto name = kv.first;

                if (!has_column(name))
                    add_column(name);

                auto column = kv.second;

                set_value(name, column->value(i));
            }
        }
    }
开发者ID:GOPRO1955,项目名称:tables,代码行数:38,代码来源:table.cpp


示例5: add_hessian_diag

 /**
  * Adds the diagonal of the Hessia of the expected log-likelihoood of
  * the specified data point to the Hessian diagonal h.
  */
 void add_hessian_diag(const table<T>& phead, const uint_vector& tail, T w,
                       table<T>& h) const {
   assert(phead.arity() + tail.size() == h.arity());
   std::size_t index = h.offset().linear(tail, phead.arity());
   for (std::size_t i = 0; i < phead.size(); ++i) {
     h[index + i] -= phead[i] * w / (f[index + i] * f[index + i]);
   }
 }
开发者ID:chongbingbao,项目名称:libgm,代码行数:12,代码来源:probability_table_ll.hpp


示例6: insert

void insert(table &fTable, char c) {
	bool inserted = false;
	for(table::iterator it = fTable.begin(); it != fTable.end(); ++it) {
		if (it->first == c) {
			++(it->second);
			inserted = true;
			break;
		}
	}
	if (!inserted) {
		pair<char, int> ins(c, 1);
		fTable.push_back(ins);
	}
}
开发者ID:arshiamufti,项目名称:huffman,代码行数:14,代码来源:encode.cpp


示例7: require_table_row_count

void require_table_row_count(const mesh::primitive& Primitive, const table& Table, const string_t& TableName, const uint_t RowCount)
{
	if(TableName == "constant")
		throw std::runtime_error("'constant' tables are automatically tested, and must have length 1.");

	if(0 == Table.column_count())
		return;

	if(Table.row_count() != RowCount)
	{
		std::ostringstream buffer;
		buffer << "[" << Primitive.type << "] table [" << TableName << "] incorrect length [" << Table.row_count() << "], expected [" << RowCount << "]";
		throw std::runtime_error(buffer.str());
	}
}
开发者ID:AwesomeDoesIt,项目名称:k3d,代码行数:15,代码来源:primitive_validation.cpp


示例8: clear

 void clear()
 {
     _table.clear();
     _columns = _rows = 0;
     _rules.clear();
     _captures.clear();
 }
开发者ID:BenHanson,项目名称:parsertl,代码行数:7,代码来源:state_machine.hpp


示例9: assign

        void assign(table const& x, true_type)
        {
            if (node_alloc() == x.node_alloc()) {
                allocators_.assign(x.allocators_);
                assign(x, false_type());
            }
            else {
                set_hash_functions new_func_this(*this, x);

                // Delete everything with current allocators before assigning
                // the new ones.
                delete_buckets();
                allocators_.assign(x.allocators_);

                // Copy over other data, all no throw.
                new_func_this.commit();
                mlf_ = x.mlf_;
                bucket_count_ = min_buckets_for_size(x.size_);
                max_load_ = 0;

                // Finally copy the elements.
                if (x.size_) {
                    static_cast<table_impl*>(this)->copy_buckets(x);
                }
            }
        }
开发者ID:BentSm,项目名称:povray,代码行数:26,代码来源:table.hpp


示例10: contains

bool contains(const table& tbl, int val)
  { // return true if tbl contains val
  int hash_val = hash(val) % tbl.size();
  bucket::const_iterator first = tbl[hash_val].begin();
  bucket::const_iterator last = tbl[hash_val].end();
  return find(first, last, val) != last;
  }
开发者ID:abo321,项目名称:books-code,代码行数:7,代码来源:hashtable.cpp


示例11: draw_loop_text

void draw_loop_text(HDC * dc, table<object_text> table)
{
	object_text pivot = table.getPivot();
	FOREACH_TABLE(table, it, object_text)
		if (it->visible)
			drawText(dc, pivot.x + it->x, pivot.y + it->y, it->w, it->h, it->size, it->text);
}
开发者ID:MaybeS,项目名称:ITE1009,代码行数:7,代码来源:drawing.cpp


示例12: move_assign

        void move_assign(table& x, false_type)
        {
            if (node_alloc() == x.node_alloc()) {
                delete_buckets();
                set_hash_functions new_func_this(*this, x);
                // No throw from here.
                mlf_ = x.mlf_;
                max_load_ = x.max_load_;
                move_buckets_from(x);
                new_func_this.commit();
            }
            else {
                set_hash_functions new_func_this(*this, x);
                new_func_this.commit();
                mlf_ = x.mlf_;
                recalculate_max_load();

                if (!size_ && !x.size_) return;

                if (x.size_ >= max_load_) {
                    create_buckets(min_buckets_for_size(x.size_));
                }
                else {
                    clear_buckets();
                }

                static_cast<table_impl*>(this)->move_assign_buckets(x);
            }
        }
开发者ID:BentSm,项目名称:povray,代码行数:29,代码来源:table.hpp


示例13: create_table

 table create_table(T&& key, int narr = 0, int nrec = 0) {
     lua_createtable(L.get(), narr, nrec);
     table result(L.get());
     lua_pop(L.get(), 1);
     global.set(std::forward<T>(key), result);
     return result;
 }
开发者ID:DominikMS,项目名称:sol,代码行数:7,代码来源:state.hpp


示例14: table

 table(table const& x, node_allocator const& a) :
     functions(x),
     allocators_(a,a),
     bucket_count_(x.min_buckets_for_size(x.size_)),
     size_(0),
     mlf_(x.mlf_),
     max_load_(0),
     buckets_()
 {}
开发者ID:BentSm,项目名称:povray,代码行数:9,代码来源:table.hpp


示例15: swap_allocators

        void swap_allocators(table& other, false_type)
        {
            boost::unordered::detail::func::ignore_unused_variable_warning(other);

            // According to 23.2.1.8, if propagate_on_container_swap is
            // false the behaviour is undefined unless the allocators
            // are equal.
            BOOST_ASSERT(node_alloc() == other.node_alloc());
        }
开发者ID:BentSm,项目名称:povray,代码行数:9,代码来源:table.hpp


示例16: show

void show(const table& tbl)
  { // show contents of buckets in table
  for (int i = 0; i < tbl.size(); ++i)
    { // show contents of bucket i
    cout << "bucket " << setw(2) << i << ": ";
    copy(tbl[i].begin(), tbl[i].end(),
      ostream_iterator<int>(cout, " "));
    cout << '\n';
    }
  }
开发者ID:abo321,项目名称:books-code,代码行数:10,代码来源:hashtable.cpp


示例17: move_init

 void move_init(table& x)
 {
     if(node_alloc() == x.node_alloc()) {
         move_buckets_from(x);
     }
     else if(x.size_) {
         // TODO: Could pick new bucket size?
         static_cast<table_impl*>(this)->move_buckets(x);
     }
 }
开发者ID:BentSm,项目名称:povray,代码行数:10,代码来源:table.hpp


示例18: column_type

void database::create_structure(table& structure_table, bool key) {
	std::unique_ptr<std::list<unsigned long>> _all_column_table_tupleID = structure_table.internalID();
	for (std::list<unsigned long>::const_iterator it = _all_column_table_tupleID->begin(); it != _all_column_table_tupleID->end(); it++) {
		std::unique_ptr<std::unordered_map<std::string, std::string>> tuple = structure_table.current(*it);
		std::string schema_name = tuple->find(column_field_name.table_schema)->second;
		std::string table_name = tuple->find(column_field_name.table_name)->second;
		std::string column_name = tuple->find(column_field_name.column_name)->second;
		std::string udt_name = tuple->find(column_field_name.udt_name)->second;
		std::string character_maximum = tuple->find(column_field_name.character_maximum_length)->second;
		std::string numeric_precision = tuple->find(column_field_name.numeric_precision)->second;
		std::string numeric_scale = tuple->find(column_field_name.numeric_scale)->second;
		sqlType::type_base* type = column_type(udt_name, character_maximum, numeric_precision, numeric_scale);

		if (!find_schema(schema_name))
			add_schema(schema_name);
		schema& _schema = get_schema(schema_name);
		if (!_schema.find_table(table_name))
			_schema.add_table(table_name);
		table& _table = _schema.get_table(table_name);
		_table.add_column(column_name, type, key);
	}
}
开发者ID:bdrSoftware,项目名称:openDB,代码行数:22,代码来源:database.cpp


示例19:

bool table::operator==(const table & another) const
{
	return this->size == another.get_size()
		&& this->pot == another.get_pot()
		&& this->street == another.get_street()
		&& this->shared == another.get_cards()
		&& this->players == another.get_players()
		&& this->blinds == another.get_blinds();
}
开发者ID:levka17,项目名称:FullTiltEquity,代码行数:9,代码来源:poker.cpp


示例20: update

void state::update(table & table)
{
	street = table.get_street();
	dealer_pos = table.get_dealer_pos();
	active_players = table.active_players_count();

	if (table.my_player_exists())
	{
		pocket = table.get_my_player().get_hand();
		equity = table.calculate_equity();
	}
	else
	{
		pocket = make_hand();
		equity = 0.f;
	}
}
开发者ID:levka17,项目名称:FullTiltEquity,代码行数:17,代码来源:poker.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ taglist_t类代码示例发布时间:2022-05-31
下一篇:
C++ t_string类代码示例发布时间: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