本文整理汇总了C++中auto_vector类的典型用法代码示例。如果您正苦于以下问题:C++ auto_vector类的具体用法?C++ auto_vector怎么用?C++ auto_vector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了auto_vector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m
void Styler_Syntax::DoStyle(StyleRun& sr, unsigned int offset, const auto_vector<stxmatch>& matches) {
const unsigned int rstart = sr.GetRunStart();
const unsigned int rend = sr.GetRunEnd();
const unsigned int styleStart = offset < rstart ? rstart - offset : 0;
const stxmatch m(wxEmptyString, NULL, styleStart, 0, 0, 0, NULL);
if (matches.empty()) return;
auto_vector<stxmatch>::const_iterator p = lower_bound(matches.begin(), matches.end(), &m, stxmatch_start_less());
if (p != matches.begin()) --p;
for (; p != matches.end(); ++p) {
const unsigned int mStart = (*p)->start+offset;
const unsigned int mEnd = (*p)->end+offset;
if (mStart > rend) break;
// Check for overlap
if (mEnd > rstart && mStart < rend) {
const unsigned int start = wxMax(rstart, mStart);
const unsigned int end = wxMin(rend, mEnd);
const style* st = (*p)->st;
if (st) {
if (st->foregroundcolor != wxNullColour) sr.SetForegroundColor(start, end, st->foregroundcolor);
if (st->backgroundcolor != wxNullColour) {
sr.SetBackgroundColor(start, end, st->backgroundcolor);
if (mEnd > rend) sr.SetExtendBgColor(st->backgroundcolor);
}
if (st->fontflags != wxFONTFLAG_DEFAULT) sr.SetFontStyle(start, end, st->fontflags);
}
// Check if there are submatches
if ((*p)->subMatch.get()) {
DoStyle(sr, (*p)->start+offset, (*p)->subMatch->matches);
}
}
}
}
示例2: addBlitterWidgets
void addBlitterWidgets(auto_vector<BlitterWidget> &blitters, VideoBufferLocker vbl) {
blitters.push_back(createX11Blitter(vbl).release());
blitters.push_back(createXvBlitter(vbl).release());
}
示例3: addAudioEngines
void addAudioEngines(auto_vector<AudioEngine> &audioEngines, WId /*winId*/) {
audioEngines.push_back(new CoreAudioEngine);
// audioEngines.push_back(createOpenAlEngine().release());
}
示例4: addAudioEngines
void addAudioEngines(auto_vector<AudioEngine> &audioEngines, WId winId) {
if (WasapiEngine::isUsable())
audioEngines.push_back(new WasapiEngine);
audioEngines.push_back(new DirectSoundEngine(winId));
}
示例5: addAudioEngines
void addAudioEngines(auto_vector<AudioEngine> &audioEngines, WId /*winId*/) {
audioEngines.push_back(new AlsaEngine);
audioEngines.push_back(new OssEngine);
}
示例6: nest
bool
ChemistryMulti::check (const Scope& scope, const Geometry& geo,
const Soil& soil, const SoilWater& soil_water,
const SoilHeat& soil_heat, const Chemistry& chemistry,
Treelog& msg) const
{
bool ok = true;
for (size_t c = 0; c < combine.size (); c++)
{
Treelog::Open nest (msg, "Chemistry: '" + combine[c]->objid + "'");
if (!combine[c]->check (scope, geo, soil, soil_water, soil_heat,
chemistry, msg))
ok = false;
}
// Check for duplicate chemicals.
std::map<symbol, size_t> found;
for (size_t i = 0; i < chemicals.size (); i++)
{
const symbol type = chemicals[i]->objid;
std::map<symbol, size_t>::const_iterator f = found.find (type);
if (f != found.end ())
{
std::ostringstream tmp;
tmp << "Chemical '" << type << "' definded in multiple chemistries:";
for (size_t j = 0; j < combine.size (); j++)
if (combine[j]->know (type))
tmp << " '" << combine[j]->objid << "'";
msg.error (tmp.str ());
ok = false;
}
found[type] = i;
}
return ok;
}
示例7: has_attribute
bool has_attribute (const symbol name) const
{
bool missing = false;
for (size_t i = 0; i < layers.size (); i++)
if (!layers[i]->horizon->has_attribute (name))
missing = true;
for (size_t i = 0; i < zones.size (); i++)
if (!zones[i]->horizon->has_attribute (name))
missing = true;
return !missing;
}
示例8: output
void ErrorEstimatorImpl::output(std::ostream& os) const
{
os << "[ErrorEstimator] iterations:" << iterationCount_ <<
" error:" << error_ << endl;
for (int i=0; i<(int)massSpreads_.size(); i++)
os << " " << *massSpreads_[i] << endl;
}
示例9: massSpread
const MassSpread* ErrorEstimatorImpl::massSpread(int index) const
{
if (index < 0 || index >= (int)massSpreads_.size())
throw out_of_range("[ErrorEstimatorImpl::massSpread] Index out of range.");
return massSpreads_[index];
}
示例10:
void
ChemistryMulti::tick_top (const Units& units, const Geometry& geo,
const Soil& soil, const SoilWater& soil_water,
const SoilHeat& soil_heat,
const double tillage_age /* [d] */,
const Surface& surface,
const double snow_leak_rate, // [h^-1]
const double canopy_cover, // [],
const double canopy_leak_rate, // [h^-1]
const double litter_cover, // [],
const double litter_leak_rate, // [h^-1]
const double surface_runoff_rate /* [h^-1] */,
const double surface_water /* [mm] */,
const double total_rain /* [mm/h] */,
const double direct_rain, // [mm/h]
const double canopy_drip /* [mm/h] */,
const double h_veg /* [m] */,
Chemistry& chemistry,
const double dt, // [h]
Treelog& msg)
{
for (size_t c = 0; c < combine.size (); c++)
combine[c]->tick_top (units, geo, soil, soil_water, soil_heat,
tillage_age, surface,
snow_leak_rate, canopy_cover, canopy_leak_rate,
litter_cover, litter_leak_rate,
surface_runoff_rate, surface_water,
total_rain, direct_rain, canopy_drip, h_veg,
chemistry, dt, msg);
}
示例11: paintColumns
void paintColumns()
{
for(size_t i=0;i< columns.size();++i)
{
}
}
示例12: clear
void clear()
{
genes.clear();
chromStart=-1;
chromEnd=-1;
positions.clear();
sample2positions.clear();
}
示例13:
void
Movement1D::initialize_derived (const Soil& soil,
const Groundwater& groundwater,
bool has_macropores, Treelog& msg)
{
TREELOG_MODEL (msg);
for (size_t i = 0; i < matrix_water.size (); i++)
matrix_water[i]->has_macropores (has_macropores);
}
示例14: iterate
void ErrorEstimatorImpl::iterate()
{
iterationCount_++;
massSpreads_.clear();
int measurementCount = int(measurements_.size());
for (int i=0; i<measurementCount; i++)
calculateMassSpread(measurements_[i]);
double errorSum = 0;
for (int i=0; i<measurementCount; i++)
errorSum += massSpreads_[i]->error();
error_ = sqrt(errorSum/measurementCount);
if (outputFile_)
output(outputFile_);
}
示例15: calculateMassSpread
void ErrorEstimatorImpl::calculateMassSpread(double measurement)
{
auto_ptr<const MassSpread> massSpread(MassSpread::create(measurement, error_, &massDatabase_));
massSpreads_.push_back(massSpread);
}