[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master dca12e0 3/3: Note a possible use case for std
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master dca12e0 3/3: Note a possible use case for std::views |
Date: |
Mon, 22 Mar 2021 18:21:48 -0400 (EDT) |
branch: master
commit dca12e060937de1372e181daa161fcb4a8a3070e
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Note a possible use case for std::views
---
ledger_invariant.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 59e296d..1347d60 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -644,6 +644,12 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant
const& a_Addend)
int Max = std::min(Length, a_Addend.Length);
// ET !! This is of the form 'x = (lengthof x) take y'.
+ // C++2x provides std::views::{drop,take}, which are somewhat
+ // similar to APL's take and drop; however, for
+ // x = (1 + lengthof(y) take y
+ // std::views would not extend the data with zeros, as APL would
+ // (in APL circles, that's called "overtake").
+ //
// Make sure total (this) has enough years to add all years of a_Addend to.
LMI_ASSERT(a_Addend.Length <= Length);
for(int j = 0; j < Max; ++j)