int main(int argc, char* argv[]) { Object* o = new Object(); S1* s = new S1(); const Class* c1 = s->GetClass(); S1* s2 = c1->CreateInstance()->Cast<S1>(); s->Cast<Object>(); s->Cast<B1>(); s->Cast<C1>(); c1 = o->GetClass(); B1* b = new B1(); c1 = b->GetClass(); g_objClassMap.add<Object>(); g_objClassMap.add<B1>(); g_objClassMap.add<B2>(); g_objClassMap.add<S1>(); g_objClassMap.add<C1>(); B1* bb = (B1*)g_objClassMap.get<B1>()->CreateInstance(); return 0; }
void callmem() { S1 s; N(s.nospec()); N(s.allspec()); N(s.intspec()); P(s.emptyspec()); }
void time_test(const S1& s1, const S2& s2, S3& s3, Op op, size_t n, size_t m) { typedef typename S1::iterator I; timer t; t.start(); for (int i = 0; i < m; ++i) std::transform(s1.begin(), s1.end(), s2.begin(), s3.begin(), op); double time = t.stop()/(double(n) * m); std::cout << std::setw(6) << std::fixed << std::setprecision(2) << time << "\t"; }
int bar(int n){ int a = 0; a += foo(n); S1 S; a += S.r1(n); a += fstatic(n); a += ftemplate<int>(n); return a; }
int bar(int n, double *ptr) { int a = 0; a += foo(n, ptr); S1 S; a += S.r1(n); a += fstatic(n); a += ftemplate<int>(n); return a; }
// CHECK: define {{.*}}@{{.*}}bar{{.*}} int bar(int n){ int a = 0; S1 S; // CHECK: call {{.*}}i32 [[FS1:@.+]]([[S1]]* {{.*}}, i32 {{.*}}) a += S.r1(n); // CHECK: call {{.*}}i32 [[FSTATIC:@.+]](i32 {{.*}}) a += fstatic(n); // CHECK: call {{.*}}i32 [[FTEMPLATE:@.+]](i32 {{.*}}) a += ftemplate<int>(n); return a; }
void Zombie::handleCollisionWith(GameObject* gameObject) { if (this->hp<=0) { this->isScheduledForRemove = true; } S1* rabit = dynamic_cast<S1*>(gameObject); if (rabit != NULL) { xSpeed = 0; rabit->setHp(rabit->getHp()-this->atk); CCBAnimationManager* animationManager = dynamic_cast<CCBAnimationManager*>(this->getUserObject()); animationManager->runAnimationsForSequenceNamed("attack"); } }
////////////////////////////////////////////////////////////////////// // we have some const_casts here so we can get at the bool AddBoundListMatches(vector< pair<int, B1*> >& boundlist, const S1& fw, const I1& rg, int edgno, bool bGoingDown, bool bStartIn) { ASSERT(((edgno & 2) != 0) == bGoingDown); pair<int, int> ilr = fw.Loclohi(rg); // pull-back from any boundaries that just cross. if ((ilr.first <= ilr.second) && fw[ilr.first].blower && (fw[ilr.first].w == rg.lo)) ilr.first++; if ((ilr.first <= ilr.second) && !fw[ilr.second].blower && (fw[ilr.second].w == rg.hi)) ilr.second--; // deal with the inside/outside info ASSERT(fw.empty() || fw.front().blower); ASSERT(fw.empty() || !fw.back().blower); bool bLeftIn = (ilr.first == 0 ? false : fw[ilr.first - 1].blower); bool bRightIn = (ilr.second == (int)(fw.size()) - 1 ? false : !fw[ilr.second + 1].blower); ASSERT(bStartIn == (bGoingDown ? bRightIn : bLeftIn)); bool bEndIn = (bGoingDown ? bLeftIn : bRightIn); // feed in the indexes of the entries if (!bGoingDown) { for (int i = ilr.first; i <= ilr.second; i++) { boundlist.push_back(pair<int, B1*>(edgno, const_cast<B1*>(&(fw[i])))); ASSERT(rg.Contains(fw[i].w)); } } else { for (int i = ilr.second; i >= ilr.first; i--) { boundlist.push_back(pair<int, B1*>(edgno, const_cast<B1*>(&(fw[i])))); ASSERT(rg.Contains(fw[i].w)); } } return bEndIn; }
void fsvtkToolpathMapper::DrawFibre(S1& fib, I1& wrg, double z) { glBegin(GL_LINE_STRIP); for (int i = 0; i < fib.size(); i++) { if ((i % 2) == 0) { glEnd(); glBegin(GL_LINE_STRIP); } //P2 p = ((fib.value_type == 1) ? P2(fib[i].w, fib.wp) : P2(fib.wp, fib[i].w)); P2 p = ((fib.ftype == 2) ? P2(fib[i].w, fib.wp) : P2(fib.wp, fib[i].w)); glVertex3d(p.u, p.v, z); } glEnd(); }
S4() : s1(s1.baz()) {}
void S2<T>::bar () { S1<T> st; st.foo(); }
static typename boost::enable_if<storages::raw_copy_possible<S1,S2>, bool >::type rcp_impl(S1 & s1, S2 const & s2) {s1.raw_copy_from(s2); return true;}
inline int bbox(dim_t axis) const { return std::max((int)first_.bbox(axis), rest_.bbox(axis)); }
static inline void set_difference(const S1 &src1, const S2 &src2, D &dst) { std::set_difference( src1.begin(), src1.end(), src2.begin(), src2.end(), std::inserter(dst, dst.begin())); }
std::string demo::__toString(const S1& arg) { return "[" + arg.toString() + "]"; }