本文整理汇总了C++中Span::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Span::end方法的具体用法?C++ Span::end怎么用?C++ Span::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Span
的用法示例。
在下文中一共展示了Span::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpansIntersect
bool SpansIntersect(const Span &a, const ContiguousSpan &b)
{
for (Span::const_iterator p = a.begin(); p != a.end(); ++p) {
if (*p >= b.first && *p <= b.second) {
return true;
}
}
return false;
}
示例2: isSatisfiedConstraint
/*!\returns true if the startpoint is before the endpoint
* of the constraint \a c.
*/
bool AbstractGrid::isSatisfiedConstraint( const Constraint& c ) const
{
// First check if the data is valid,
// TODO: review if true is the right choice
if ( !c.startIndex().isValid() || !c.endIndex().isValid() ) return true;
Span ss = mapToChart( c.startIndex() );
Span es = mapToChart( c.endIndex() );
return ( ss.end() <= es.start() );
}
示例3: testRuntimeSpan
void testRuntimeSpan(Span sp)
{
LIBCPP_ASSERT((noexcept(sp.template subspan<Offset>())));
LIBCPP_ASSERT((noexcept(sp.subspan(Offset))));
auto s1 = sp.template subspan<Offset>();
auto s2 = sp.subspan(Offset);
using S1 = decltype(s1);
using S2 = decltype(s2);
ASSERT_SAME_TYPE(typename Span::value_type, typename S1::value_type);
ASSERT_SAME_TYPE(typename Span::value_type, typename S2::value_type);
static_assert(S1::extent == (Span::extent == std::dynamic_extent ? std::dynamic_extent : Span::extent - Offset), "");
static_assert(S2::extent == std::dynamic_extent, "");
assert(s1.data() == s2.data());
assert(s1.size() == s2.size());
assert(std::equal(s1.begin(), s1.end(), sp.begin() + Offset, sp.end()));
}
示例4: dt
QDateTime s2 = model.data( model.index( 1, 0 ), StartTimeRole ).toDateTime();
QDateTime e2 = model.data( model.index( 1, 0 ), EndTimeRole ).toDateTime();
assertTrue( s1.isValid() );
assertTrue( e1.isValid() );
assertTrue( s2.isValid() );
assertTrue( e2.isValid() );
assertEqual( s1, s2 );
assertEqual( e1, e2 );
assertTrue( grid.isSatisfiedConstraint( Constraint( model.index( 0, 0 ), model.index( 2, 0 ) ) ) );
assertFalse( grid.isSatisfiedConstraint( Constraint( model.index( 2, 0 ), model.index( 0, 0 ) ) ) );
s = grid.mapToChart( model.index( 0, 0 ) );
s.setEnd( s.end()+100000. );
bool rc = grid.mapFromChart( s, model.index( 0, 0 ) );
assertTrue( rc );
assertEqual( s1, model.data( model.index( 0, 0 ), StartTimeRole ).toDateTime() );
Span newspan = grid.mapToChart( model.index( 0, 0 ) );
assertEqual( newspan.start(), s.start() );
assertEqual( newspan.length(), s.length() );
{
QDateTime startDateTime = QDateTime::currentDateTime();
qreal dayWidth = 100;
QDate currentDate = QDate::currentDate();
QDateTime dt( QDate(currentDate.year(), 1, 1), QTime( 0, 0, 0, 0 ) );
assert( dt.isValid() );
qreal result = startDateTime.date().daysTo(dt.date())*24.*60.*60.;
result += startDateTime.time().msecsTo(dt.time())/1000.;
示例5: end
Iterator end(Span<Iterator> range)
{
return range.end();
}
示例6: makeSpan
Span<std::reverse_iterator<Iterator>>
makeReverseSpan(Span<Iterator> range)
{
return makeSpan(std::reverse_iterator<Iterator>(range.end()),
std::reverse_iterator<Iterator>(range.begin()));
}