| 419 | |
| 420 | template<typename T> |
| 421 | int Array<T>::getSize(const int index) const |
| 422 | { |
| 423 | try |
| 424 | { |
| 425 | // Matlab style: |
| 426 | // If empty -> return 0 |
| 427 | // If index >= # dimensions -> return 1 |
| 428 | if ((unsigned int)index < mSize.size() && 0 <= index) |
| 429 | return mSize[index]; |
| 430 | // Long version: |
| 431 | // else if (mSize.empty()) |
| 432 | // return 0; |
| 433 | // else // if mSize.size() <= (unsigned int)index |
| 434 | // return 1; |
| 435 | // Equivalent to: |
| 436 | else |
| 437 | return (!mSize.empty()); |
| 438 | } |
| 439 | catch (const std::exception& e) |
| 440 | { |
| 441 | error(e.what(), __LINE__, __FUNCTION__, __FILE__); |
| 442 | return 0; |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | template<typename T> |
| 447 | std::string Array<T>::printSize() const |
no test coverage detected