本文整理汇总了C++中optional::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ optional::clear方法的具体用法?C++ optional::clear怎么用?C++ optional::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类optional
的用法示例。
在下文中一共展示了optional::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void apply(Atmosphere& atmo)
{
if (visibility.isSet())
{
atmo.GetConditions().SetVisibility(visibility.get());
visibility.clear();
}
if (rain.isSet())
{
atmo.GetConditions().SetPrecipitation(CloudLayer::NONE, 0.0);
atmo.GetConditions().SetPrecipitation(CloudLayer::RAIN, rain.get());
rain.clear();
}
if (snow.isSet())
{
atmo.GetConditions().SetPrecipitation(CloudLayer::NONE, 0.0);
atmo.GetConditions().SetPrecipitation(CloudLayer::DRY_SNOW, snow.get());
snow.clear();
}
if (lighting.isSet())
{
sky->setLighting(lighting.get());
lighting.clear();
}
}
示例2: apply
void apply(Environment& env, Ocean& ocean)
{
if (chop.isSet())
{
ocean.SetChoppiness(chop.get());
chop.clear();
}
if (seaState.isSet())
{
env.SimulateSeaState(seaState.get(), 0.0);
seaState.clear();
}
//if (alpha.isSet())
//{
// triton->setAlpha( alpha.get() );
//}
}
示例3: apply
void apply(Environment& env, Ocean& ocean)
{
if (chop.isSet())
{
ocean.SetChoppiness(chop.get());
chop.clear();
}
if (seaState.isSet())
{
env.SimulateSeaState(seaState.get(), 0.0);
seaState.clear();
}
osg::ref_ptr<TritonLayer> layer;
if (alpha.isSet() && tritonLayer.lock(layer))
{
layer->setOpacity(alpha.value());
alpha.clear();
}
}
示例4: swap
void swap (optional& other) {
if(empty_ && other.empty_) return;
if(empty_) {
*this = std::move(other);
other.clear();
return;
}
if(other.empty_) {
other = std::move(*this);
this->clear();
return;
}
swap(**this, *other);
}