Project

General

Profile

Feature #312

LongRange(a,b) returning vector of long a..b (included)

Added by Anna Maria Bigatti about 11 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Category:
New Function
Target version:
Start date:
14 Feb 2013
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:

Description

I do miss in C++ the convenient cocoa syntax a..b.
In fact it is particularly useful for calling submat.
So I suggest having LongRange in utils.H
(that implies including in it vector.H)


Related issues

Related to CoCoALib - Feature #357: Constructor for vectors? CoCoAVectorRejected2013-05-24

Related to CoCoALib - Feature #1472: Idea for for loopsIn Progress2020-07-23

Related to CoCoALib - Feature #202: MatrixView/function for viewing a single row or column (RowMat, ColMat)Closed2012-07-04

Related to CoCoALib - Design #64: submat takes only vector<long>Closed2011-12-15

Related to CoCoALib - Design #601: LongRange: in which file should it be declared/defined?In Progress2014-07-31

Related to CoCoALib - Feature #1788: New MatrixView/function "FirstRows/FirstCols"?Closed2024-03-08

History

#1 Updated by John Abbott about 11 years ago

It is a shame to have to include the standard header <vector> in the file utils.H.

It may not be relevant, but I notice that there is a file ULong2Long.H which contains essentially one inline fn. So we could put LongRange into a separate file.

However, I believe ULong2Long is in a separate file for a specific good reason: so that the test compilations made by the configure-time script cpp-flags-ulong2long.sh are particularly simple.

#2 Updated by John Abbott about 11 years ago

It's not very important, but JAA thinks that LongRange should not be inline:
its impl is not that short, and run-time efficiency is not that crucial (e.g. it won't be called millions of times).

Unfortunately, making it not inline does not let us remove #include <vector> from the header file... sigh! Maybe some future version of C++ will allow it...?

#3 Updated by Anna Maria Bigatti almost 11 years ago

  • Category set to New Function
  • Status changed from New to Feedback
  • Assignee set to Anna Maria Bigatti
  • Target version set to CoCoALib-0.9953
  • % Done changed from 0 to 90

#4 Updated by John Abbott almost 11 years ago

It might be worth moving the impl into its own separate file: this would remove the need to include vector in the header file for utils.

#5 Updated by Anna Maria Bigatti over 10 years ago

John Abbott wrote:

It might be worth moving the impl into its own separate file: this would remove the need to include vector in the header file for utils.

I think we'd better keep it in utils: if we find that we have a suitable number of "utils" needing vector we will make a separate file for them and move there LongRange

#6 Updated by Anna Maria Bigatti about 10 years ago

  • Target version changed from CoCoALib-0.9953 to CoCoALib-0.99532

#7 Updated by Anna Maria Bigatti about 10 years ago

  • Estimated time set to 2.00 h

#8 Updated by Anna Maria Bigatti about 10 years ago

I added some commented out calls to LongRange (to replace the existing for loops).
For paranoia, needs testing (not my code, mainly ApproxPts2)

#9 Updated by John Abbott about 10 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100

No problems in almost a year --> closing.

#10 Updated by John Abbott almost 4 years ago

#11 Updated by Anna Maria Bigatti about 2 months ago

  • Related to Feature #202: MatrixView/function for viewing a single row or column (RowMat, ColMat) added

#12 Updated by Anna Maria Bigatti about 2 months ago

  • Related to Design #64: submat takes only vector<long> added

#13 Updated by Anna Maria Bigatti about 2 months ago

  • Related to Design #601: LongRange: in which file should it be declared/defined? added

#14 Updated by Anna Maria Bigatti about 2 months ago

  • Related to Feature #1788: New MatrixView/function "FirstRows/FirstCols"? added

Also available in: Atom PDF