当前位置: 首页>>代码示例>>C++>>正文


C++ Cont::size方法代码示例

本文整理汇总了C++中Cont::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Cont::size方法的具体用法?C++ Cont::size怎么用?C++ Cont::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cont的用法示例。


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

示例1: GAppSetOpts_ranged

inline void GAppSetOpts_ranged(const char *value, Cont& cont) {
	cont.clear();
	bool had_range = false;

	const char *comma = value;
	do {
		uint32_t low = abs(atoi(comma)), high = low;
		const char *delim = strchr(comma, '-');
		const char *nextc = strchr(comma, ',');
		if (delim && (nextc == 0 || nextc > delim)) {
			had_range = true;
			high = abs(atoi(delim + 1));
		}
		for (; low <= high; ++low) {
			cont.push_back(low);
		}
	} while ((comma = strchr(comma, ',')) != 0 && ++comma && *comma != 0);

	if (cont.size() == 1 && !had_range) {
		uint32_t val = cont.front();
		cont.clear();
		for (uint32_t i = 1; i <= val; ++i) {
			cont.push_back(i);
		}
	}
}
开发者ID:estnltk,项目名称:estnltk-vislcg3,代码行数:26,代码来源:inlines.hpp

示例2: test_serialization_helper

void test_serialization_helper()
{
    Cont vec;
    add( vec, new Base( -1 ), 0u );
    add( vec, new Derived( 1 ), 1u );

    std::ofstream ofs("filename");
    boost::archive::text_oarchive oa(ofs);
    oa << as_const(vec);
    ofs.close();

    
    
    std::ifstream ifs("filename", std::ios::binary);
    boost::archive::text_iarchive ia(ifs);
    Cont vec2;
    ia >> vec2;
    ifs.close();

    BOOST_CHECK_EQUAL( vec.size(), vec2.size() );
    BOOST_CHECK_EQUAL( (*vec2.begin()).i, -1 );
    BOOST_CHECK_EQUAL( (*--vec2.end()).i, 0 );
    typename Cont::iterator i = vec2.end();
    --i;
    Derived* d = dynamic_cast<Derived*>( &*i ); 
    BOOST_CHECK_EQUAL( d->i2, 1 );
}
开发者ID:KerwinMa,项目名称:AerothFlyffSource,代码行数:27,代码来源:serialization.cpp

示例3: average

 NumericT average(const Cont<NumericT>& vals) const
    {
       std::cout << "lin average " << std::endl;
       if (vals.size() == 0)
          return NumericT(0.);    // Concept:: neutral element
       
       double	dval(0.0);
       for (unsigned int i(0); i < vals.size(); ++i)
       {
          double	dv(*vals[i]);
          
          dval += dv;
       }
       
       dval = dval/(double(vals.size()));
       return NumericT(dval);	
    }
开发者ID:AlexanderToifl,项目名称:viennamesh-dev,代码行数:17,代码来源:interpolation.hpp

示例4: do_move

static void do_move(Cont& styls, int type, int& first, int& last, bool storage) {
	auto begin = styls.begin();

	// Move up
	if (type == 0) {
		if (first == 0) return;
		rotate(begin + first - 1, begin + first, begin + last + 1);
		first--;
		last--;
	}
	// Move to top
	else if (type == 1) {
		rotate(begin, begin + first, begin + last + 1);
		last = last - first;
		first = 0;
	}
	// Move down
	else if (type == 2) {
		if (last + 1 == (int)styls.size()) return;
		rotate(begin + first, begin + last + 1, begin + last + 2);
		first++;
		last++;
	}
	// Move to bottom
	else if (type == 3) {
		rotate(begin + first, begin + last + 1, styls.end());
		first = styls.size() - (last - first + 1);
		last = styls.size() - 1;
	}
	// Sort
	else if (type == 4) {
		// Get confirmation
		if (storage) {
			int res = wxMessageBox(_("Are you sure? This cannot be undone!"), _("Sort styles"), wxYES_NO | wxCENTER);
			if (res == wxNO) return;
		}

		sort(styls.begin(), styls.end(), cmp_name());

		first = 0;
		last = 0;
	}
}
开发者ID:liloneum,项目名称:Aegisub,代码行数:43,代码来源:dialog_style_manager.cpp

示例5: operator

 void operator()(Cont& c, long count) {
     long cnt = count * 10;
     if (cnt > c.size()) {
         cout << "RemoveBack: not enough elements"
              << endl;
         return;
     }
     for (long i = 0; i < cnt; i++)
         c.pop_back();
 }
开发者ID:finalx,项目名称:finalx-labs-all,代码行数:10,代码来源:SequencePerformance.cpp

示例6: push

 inline std::enable_if_t<std::is_base_of<T, std::decay_t<U>>::value> push(U&& value) {
     std::unique_lock<std::mutex> lock(mut);
     // only add the value on the stack if there is room
     data_cond.wait(lock, [this]{
         return (data_queue.size() < capacity) || shutdownFlag;
     });
     data_queue.emplace(std::make_shared<
         std::decay_t<U>> (std::forward<U>(value)));
     data_cond.notify_one();
 }
开发者ID:WhiZTiM,项目名称:coliru,代码行数:10,代码来源:main.cpp

示例7: size

 static size_type size(Cont const &cont) { return cont.size(); }
开发者ID:rtsuk,项目名称:fmsync,代码行数:1,代码来源:array_traits.hpp

示例8: size

	size_type size() const { return container.size(); }
开发者ID:ThePhD,项目名称:vlm_performance,代码行数:1,代码来源:ordered.hpp

示例9: check_empty

inline bool check_empty(const Cont &c)
{
  return c.empty() && c.size() == 0 && c.begin() == c.end();
}
开发者ID:lrineau,项目名称:cgal,代码行数:4,代码来源:test_Concurrent_compact_container.cpp

示例10: create_i_buffer

	com_ptr<ID3D11Buffer> create_i_buffer(device_type device, UINT cpu_access_flags, D3D11_USAGE usage, const Cont& cont) {
		return create_i_buffer(device, cpu_access_flags, usage, sizeof(Cont::value_type) * cont.size());
	}
开发者ID:ftbmynameis,项目名称:graphic_play_around,代码行数:3,代码来源:d3d.hpp

示例11: max

 inline typename Cont::size_type max() const {
   return not_prime.size()-1;
 }
开发者ID:janmarthedal,项目名称:snippets,代码行数:3,代码来源:prime_checker_bounded_wheel.hpp


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