本文整理汇总了C++中end函数的典型用法代码示例。如果您正苦于以下问题:C++ end函数的具体用法?C++ end怎么用?C++ end使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
/** \throw NonexistentParameterAccessed if \p name is not a key. */
ParameterMap::iterator ParameterMap::findOrThrow(const std::string& name) {
map_type::iterator it = find(name);
if (it != end()) return it;
throw ParameterMap::NonexistentParameterAccessed(name, *this);
}
示例2: operator
std::pair<I, O> operator()(Rng &rng, O out, P proj = P{}) const
{
return (*this)(begin(rng), end(rng), std::move(out), std::move(proj));
}
示例3: end
SimpleAudioEngineOpenSL::~SimpleAudioEngineOpenSL()
{
end();
}
示例4: Fl_Group
/* Fl_Group( X, Y, W, H, L) */
Chain::Chain ( ) : Fl_Group( 0, 0, 100, 100, "")
{
/* not really deleting here, but reusing this variable */
_deleting = true;
int X = 0;
int Y = 0;
int W = 100;
int H = 100;
/* _outs = 1; */
/* _ins = 1; */
_configure_outputs_callback = NULL;
_strip = NULL;
_name = NULL;
labelsize( 10 );
align( FL_ALIGN_TOP );
{ Fl_Flip_Button* o = tab_button = new Fl_Flip_Button( X, Y, W, 16, "chain/controls");
o->type(1);
o->labelsize( 12 );
o->callback( cb_handle, this );
}
Y += 18;
H -= 18;
{ Fl_Group *o = chain_tab = new Fl_Group( X, Y, W, H, "" );
o->labeltype( FL_NO_LABEL );
o->box( FL_FLAT_BOX );
// o->color( fl_darker( FL_BACKGROUND_COLOR ) );
// o->color( FL_BACKGROUND_COLOR );
// o->box( FL_NO_BOX );
{ Fl_Packscroller *o = new Fl_Packscroller( X, Y, W, H );
o->color( FL_BACKGROUND_COLOR );
// o->box( FL_FLAT_BOX );
o->box( FL_THIN_UP_BOX );
o->type( Fl_Scroll::VERTICAL );
{ Fl_Pack *o = modules_pack = new Fl_Pack( X, Y, W, H );
o->type( Fl_Pack::VERTICAL );
o->spacing( 6 );
o->end();
Fl_Group::current()->resizable( o );
}
o->end();
}
o->end();
}
{ Fl_Group *o = control_tab = new Fl_Group( X, Y, W, H, "" );
o->box( FL_FLAT_BOX );
o->color( FL_BACKGROUND_COLOR );
o->labeltype( FL_NO_LABEL );
o->hide();
{ Fl_Scroll *o = new Fl_Scroll( X, Y, W, H );
o->color( FL_BACKGROUND_COLOR );
o->box( FL_NO_BOX );
o->type( Fl_Scroll::VERTICAL );
{ Fl_Pack *o = controls_pack = new Fl_Pack( X, Y, W, H );
o->type( Fl_Pack::VERTICAL );
o->spacing( 5 );
// o->color( FL_RED );
o->end();
Fl_Group::current()->resizable( o );
}
o->end();
Fl_Group::current()->resizable( o );
}
o->end();
o->hide();
Fl_Group::current()->resizable( o );
}
end();
log_create();
_deleting = false;
}
示例5: furn_item
void inventory::form_from_map( const tripoint &origin, int range, bool assign_invlet )
{
items.clear();
for( const tripoint &p : g->m.points_in_radius( origin, range ) ) {
if (g->m.has_furn( p ) && g->m.accessible_furniture( origin, p, range )) {
const furn_t &f = g->m.furn_at( p );
itype *type = f.crafting_pseudo_item_type();
if (type != NULL) {
item furn_item(type->id, 0);
const itype *ammo = f.crafting_ammo_item_type();
if (ammo != NULL) {
furn_item.charges = count_charges_in_list( ammo, g->m.i_at( p ) );
}
furn_item.item_tags.insert("PSEUDO");
add_item(furn_item);
}
}
if( !g->m.accessible_items( origin, p, range ) ) {
continue;
}
for (auto &i : g->m.i_at( p )) {
if (!i.made_of(LIQUID)) {
add_item(i, false, assign_invlet);
}
}
// Kludges for now!
ter_id terrain_id = g->m.ter( p );
if (g->m.has_nearby_fire( p, 0 )) {
item fire("fire", 0);
fire.charges = 1;
add_item(fire);
}
if (terrain_id == t_water_sh || terrain_id == t_water_dp ||
terrain_id == t_water_pool || terrain_id == t_water_pump) {
item water("water", 0);
water.charges = 50;
add_item(water);
}
if (terrain_id == t_swater_sh || terrain_id == t_swater_dp) {
item swater("salt_water", 0);
swater.charges = 50;
add_item(swater);
}
// add cvd forge from terrain
if (terrain_id == t_cvdmachine) {
item cvd_machine("cvd_machine", 0);
cvd_machine.charges = 1;
cvd_machine.item_tags.insert("PSEUDO");
add_item(cvd_machine);
}
// kludge that can probably be done better to check specifically for toilet water to use in
// crafting
if (g->m.furn_at( p ).examine == &iexamine::toilet) {
// get water charges at location
auto toilet = g->m.i_at( p );
auto water = toilet.end();
for( auto candidate = toilet.begin(); candidate != toilet.end(); ++candidate ) {
if( candidate->typeId() == "water" ) {
water = candidate;
break;
}
}
if( water != toilet.end() && water->charges > 0) {
add_item( *water );
}
}
// keg-kludge
if (g->m.furn_at( p ).examine == &iexamine::keg) {
auto liq_contained = g->m.i_at( p );
for( auto &i : liq_contained ) {
if( i.made_of(LIQUID) ) {
add_item(i);
}
}
}
// WARNING: The part below has a bug that's currently quite minor
// When a vehicle has multiple faucets in range, available water is
// multiplied by the number of faucets.
// Same thing happens for all other tools and resources, but not cargo
int vpart = -1;
vehicle *veh = g->m.veh_at( p, vpart );
if( veh == nullptr ) {
continue;
}
//Adds faucet to kitchen stuff; may be horribly wrong to do such....
//ShouldBreak into own variable
const int kpart = veh->part_with_feature(vpart, "KITCHEN");
const int faupart = veh->part_with_feature(vpart, "FAUCET");
const int weldpart = veh->part_with_feature(vpart, "WELDRIG");
const int craftpart = veh->part_with_feature(vpart, "CRAFTRIG");
const int forgepart = veh->part_with_feature(vpart, "FORGE");
const int chempart = veh->part_with_feature(vpart, "CHEMLAB");
const int cargo = veh->part_with_feature(vpart, "CARGO");
if (cargo >= 0) {
*this += std::list<item>( veh->get_items(cargo).begin(),
//.........这里部分代码省略.........
示例6:
//--------------------------------------------------
ofBuffer::ofBuffer()
:currentLine(end(),end()){
buffer.resize(1);
}
示例7: find
std::string WizardImpl::searchForSpell(std::string const &wish) {
auto const spell = find(begin(books), end(books), wish);
return spell!=end(books)?*spell:"";
}
示例8: return
bool UniString::IsEqualAscii(char const * s) const
{
return (size() == strlen(s) && equal(begin(), end(), s));
}
示例9: main
int main()
{
try {
enum pubnub_res res;
std::string chan("hello_world");
pubnub::context pb("demo", "demo");
/* Leave this commented out to use the default - which is
blocking I/O on most platforms. Uncomment to use non-
blocking I/O.
*/
pb.set_blocking_io(pubnub::non_blocking);
if (0 != pb.set_uuid_v4_random()) {
pb.set_uuid("zeka-peka-iz-jendeka");
}
else {
std::cout << "Generated UUID: " << pb.uuid() << std::endl;
}
pb.set_auth("danaske");
pb.set_transaction_timeout(
#if __cplusplus >= 201103L
std::chrono::seconds(10)
#else
10000
#endif
);
std::cout << "First subscribe / connect" << std::endl;
if (PNR_OK == pb.subscribe(chan).await()) {
std::cout << "Subscribe/connected!" << std::endl;
}
else {
std::cout << "Subscribe failed!" << std::endl;
}
#if PUBNUB_CRYPTO_API
std::cout << "Publishing encrypted" << std::endl;
pubnub::futres futres = pb.publish_encrypted(chan, "\"Hello world from C++!\"", "KUKUMENEGRDNA");
#else
std::cout << "Publishing" << std::endl;
pubnub::futres futres = pb.publish(chan, "\"Hello world from C++!\"");
#endif
res = futres.await();
if (PNR_OK == res) {
std::cout << "Published! Response from Pubnub: " << pb.last_publish_result() << std::endl;
}
else if (PNR_PUBLISH_FAILED == res) {
std::cout << "Published failed on Pubnub, description: " << pb.last_publish_result() << std::endl;
}
else {
std::cout << "Publishing failed with code: " << res << std::endl;
}
std::cout << "Subscribing" << std::endl;
if (PNR_OK == pb.subscribe(chan).await()) {
std::cout << "Subscribed! Got messages:" << std::endl;
/// Lets illustrate getting all the message in a vector,
/// and iterating over it
#if __cplusplus >= 201103L
#if PUBNUB_CRYPTO_API
auto msg = pb.get_all_decrypted("KUKUMENEGRDNA");
#else
auto msg = pb.get_all();
#endif
for (auto it = msg.begin(); it != msg.end(); ++it) {
std::cout << *it << std::endl;
}
#else
#if PUBNUB_CRYPTO_API
std::vector<std::string> msg = pb.get_all_decrypted("KUKUMENEGRDNA");
#else
std::vector<std::string> msg = pb.get_all();
#endif
for (std::vector<std::string>::iterator it = msg.begin(); it != msg.end(); ++it) {
std::cout << *it << std::endl;
}
#endif
}
else {
std::cout << "Subscribe failed!" << std::endl;
}
std::cout << "Getting time" << std::endl;
if (PNR_OK == pb.time().await()) {
std::cout << "Gotten time " << pb.get() << "; last time token="<< pb.last_time_token() << std::endl;
}
else {
std::cout << "Getting time failed!" << std::endl;
}
std::cout << "Getting history" << std::endl;
res = pb.history(chan).await();
if (PNR_OK == res) {
std::cout << "Got history! Messages:" << std::endl;
/// Lets illustrate getting all the message in a vector,
/// and then accessing each vector index in a loop
#if __cplusplus >= 201103L
auto msg = pb.get_all();
//.........这里部分代码省略.........
示例10: emit_class
void emit_class(EmitUnitState& state,
UnitEmitter& ue,
const php::Class& cls) {
FTRACE(2, " class: {}\n", cls.name->data());
auto const pce = ue.newPreClassEmitter(
cls.name,
cls.hoistability
);
pce->init(
std::get<0>(cls.srcInfo.loc),
std::get<1>(cls.srcInfo.loc),
ue.bcPos(),
cls.attrs,
cls.parentName ? cls.parentName : s_empty.get(),
cls.srcInfo.docComment
);
pce->setUserAttributes(cls.userAttributes);
for (auto& x : cls.interfaceNames) pce->addInterface(x);
for (auto& x : cls.usedTraitNames) pce->addUsedTrait(x);
for (auto& x : cls.requirements) pce->addClassRequirement(x);
for (auto& x : cls.traitPrecRules) pce->addTraitPrecRule(x);
for (auto& x : cls.traitAliasRules) pce->addTraitAliasRule(x);
for (auto& m : cls.methods) {
FTRACE(2, " method: {}\n", m->name->data());
auto const fe = ue.newMethodEmitter(m->name, pce);
emit_init_func(*fe, *m);
pce->addMethod(fe);
auto const info = emit_bytecode(state, ue, *m);
emit_finish_func(*m, *fe, info);
}
auto const privateProps = state.index.lookup_private_props(&cls);
auto const privateStatics = state.index.lookup_private_statics(&cls);
for (auto& prop : cls.properties) {
auto const repoTy = [&] (const PropState& ps) -> RepoAuthType {
// TODO(#3599292): we don't currently infer closure use var types.
if (is_closure(cls)) return RepoAuthType{};
auto it = ps.find(prop.name);
if (it == end(ps)) return RepoAuthType{};
auto const rat = make_repo_type(*state.index.array_table_builder(),
it->second);
merge_repo_auth_type(ue, rat);
return rat;
};
pce->addProperty(
prop.name,
prop.attrs,
prop.typeConstraint,
prop.docComment,
&prop.val,
(prop.attrs & AttrStatic) ? repoTy(privateStatics) : repoTy(privateProps)
);
}
for (auto& cconst : cls.constants) {
pce->addConstant(
cconst.name,
cconst.typeConstraint,
&cconst.val,
cconst.phpCode
);
}
pce->setEnumBaseTy(cls.enumBaseTy);
}
示例11: emit_ehent_tree
//.........这里部分代码省略.........
auto const parent = activeList.empty()
? nullptr
: borrow(exnMap[activeList.back()].back());
exnMap[p].push_back(
folly::make_unique<EHRegion>(
EHRegion { p, parent, start, kInvalidOffset }
)
);
activeList.push_back(p);
};
/*
* Walk over the blocks, and compare the new block's exnNode path to
* the active one. Find the least common ancestor of the two paths,
* then modify the active list by popping and then pushing nodes to
* set it to the new block's path.
*/
for (auto& b : info.blockOrder) {
auto const offset = info.blockInfo[b->id].offset;
if (!b->exnNode) {
while (!activeList.empty()) pop_active(offset);
continue;
}
std::vector<borrowed_ptr<const php::ExnNode>> current;
exn_path(current, b->exnNode);
auto const prefix = shared_prefix(current, activeList);
for (size_t i = prefix, sz = activeList.size(); i < sz; ++i) {
pop_active(offset);
}
for (size_t i = prefix, sz = current.size(); i < sz; ++i) {
push_active(current[i], offset);
}
if (debug && !activeList.empty()) {
current.clear();
exn_path(current, activeList.back());
assert(current == activeList);
}
}
while (!activeList.empty()) {
pop_active(info.blockInfo[info.blockOrder.back()->id].past);
}
/*
* We've created all our regions, but we need to sort them instead
* of trying to get the UnitEmitter to do it.
*
* The UnitEmitter expects EH regions that look a certain way
* (basically the way emitter.cpp likes them). There are some rules
* about the order it needs to have at runtime, which we set up
* here.
*
* Essentially, an entry a is less than an entry b iff:
*
* - a starts before b
* - a starts at the same place, but encloses b entirely
* - a has the same extents as b, but is a parent of b
*/
std::vector<borrowed_ptr<EHRegion>> regions;
for (auto& mapEnt : exnMap) {
for (auto& region : mapEnt.second) {
regions.push_back(borrow(region));
}
}
std::sort(
begin(regions), end(regions),
[&] (borrowed_ptr<const EHRegion> a, borrowed_ptr<const EHRegion> b) {
if (a == b) return false;
if (a->start == b->start) {
if (a->past == b->past) {
// When regions exactly overlap, the parent is less than the
// child.
for (auto p = b->parent; p != nullptr; p = p->parent) {
if (p == a) return true;
}
// If a is not a parent of b, and they have the same region;
// then b better be a parent of a.
if (debug) {
auto p = a->parent;
for (; p != b && p != nullptr; p = p->parent) continue;
assert(p == b);
}
return false;
}
return a->past > b->past;
}
return a->start < b->start;
}
);
std::map<borrowed_ptr<const EHRegion>,uint32_t> parentIndexMap;
for (auto& r : regions) {
emit_eh_region(fe, r, info.blockInfo, parentIndexMap);
}
fe.setEHTabIsSorted();
}
示例12: setpg
inline void setpg(char_type * pp, char_type * gp)
{
setp(pp, end());
setg(gp, gp, pp);
}
示例13: operator
std::pair<I, O>
operator()(Rng &rng, ORng &result, BOp bop = BOp{}, P proj = P{}) const
{
return (*this)(begin(rng), end(rng), begin(result), end(result),
std::move(bop), std::move(proj));
}
示例14: sizeof
bool Bitmap_Handler::export_image(Image_8 * image, const char * file_name)
{
auto output = std::ofstream{ file_name, std::ios::binary };
output << "BM";
//File Size Parameter
uint32_t var_32_u = 54 + 3 * image->get_pixels()->size();
for (int i = 0; i < ((image->size_x * 3) % 4); i++) {
var_32_u += image->size_y;
}
output.write( (char*) &var_32_u, sizeof(var_32_u));
//Reserved
var_32_u = 0;
output.write((char*)&var_32_u, sizeof(var_32_u));
//Image offset
var_32_u = 54;
output.write((char*)&var_32_u, sizeof(var_32_u));
//Infoheader Size
var_32_u = 40;
output.write((char*)&var_32_u, sizeof(var_32_u));
//Width
int32_t var_32_s = image->size_x;
output.write((char*)&var_32_s, sizeof(var_32_s));
//Height
var_32_s = image->size_y;
output.write((char*)&var_32_s, sizeof(var_32_s));
//Unused
uint16_t var_16_u = 1;
output.write((char*)&var_16_u, sizeof(var_16_u));
//biBitCount
var_16_u = 24;
output.write((char*)&var_16_u, sizeof(var_16_u));
//Compression
var_32_u = 0;
output.write((char*)&var_32_u, sizeof(var_32_u));
//SizeImage
var_32_u = 0;
output.write((char*)&var_32_u, sizeof(var_32_u));
//Pixels per Meter
var_32_u = 0;
output.write((char*)&var_32_u, sizeof(var_32_u));
output.write((char*)&var_32_u, sizeof(var_32_u));
//Color Table
var_32_u = 0;
output.write((char*)&var_32_u, sizeof(var_32_u));
//Colors used
var_32_u = 0;
output.write((char*)&var_32_u, sizeof(var_32_u));
unsigned int row_ind = 0;
auto pixels = image->get_pixels();
unsigned int z = 0;
for (auto it = pixels->begin(); it != pixels->end(); it++) {
int t_r = (*it).get_r();
output.write((char*)&(t_r), 1);
int t_g = (*it).get_g();
output.write((char*)&(t_g), 1);
int t_b = (*it).get_b();
output.write((char*)&(t_b), 1);
row_ind += 3;
z++;
//Catch last Bytes in Row
if (z == (image->size_x)) {
while (row_ind % 4 != 0) {
row_ind++;
uint8_t t_a = 0;
output.write((char*)&t_a, 1);
}
row_ind = 0;
z = 0;
}
}
output.close();
return true;
}
示例15: while
void MobileSimulator::MouseUpEvent(Vec2i screenCoordinates, MouseButtonInput button)
{
_multiGestureOngoing = false;
_gestureType = NONE;
_mouseDown = false;
TouchList* tl = &TouchListener::GetTouchList();
if (theInput.IsKeyDown(ANGEL_KEY_LEFTCONTROL) || theInput.IsKeyDown(ANGEL_KEY_RIGHTCONTROL))
{
TouchList::iterator it = tl->begin();
while (it != tl->end())
{
SendTouchNotifiers((*it), TOUCH_END);
delete (*it);
it = tl->erase(it);
}
}
else
{
// just a single touch, but we'll iterate anyway
TouchList::iterator it = tl->begin();
while (it != tl->end())
{
if ( (theWorld.GetCurrentTimeSeconds() - (*it)->MotionStartTime) < SWIPE_MAX_DURATION)
{
Vector2 start((*it)->StartingPoint);
Vector2 end((*it)->CurrentPoint);
Vector2 motion = end - start;
if (motion.LengthSquared() >= (SWIPE_MIN_DISTANCE * SWIPE_MIN_DISTANCE))
{
float angle = MathUtil::ToDegrees(acos(Vector2::Dot(Vector2::UnitX, Vector2::Normalize(motion))));
if (motion.Y > 0.0f)
{
angle = 360.0f - angle;
}
if ( (angle > 45.0f) && (angle <= 135.0f) )
{
// swipe up
theSwitchboard.Broadcast(new Message("MultiTouchSwipeUp"));
}
else if ( (angle > 135.0f) && (angle <= 225.0f) )
{
// swipe left
theSwitchboard.Broadcast(new Message("MultiTouchSwipeLeft"));
}
else if ( (angle > 225.0f) && (angle <= 315.0f) )
{
// swipe down
theSwitchboard.Broadcast(new Message("MultiTouchSwipeDown"));
}
else
{
// swipe right
theSwitchboard.Broadcast(new Message("MultiTouchSwipeRight"));
}
}
}
SendTouchNotifiers((*it), TOUCH_END);
delete (*it);
it = tl->erase(it);
}
}
}