Checks if the array contains only one element. More...

bool isscalar () const
 Checks if the array contains only one element. More...
 

Detailed Description

Checks if the array contains only one element.

array a(1);
if(a.isscalar())
printf("a is a scalar\n"); //Will be printed as a has one element
array b(5);
array c(0);
if(b.isscalar() || c.isscalar())
; //statement not reachable as neither b nor c are scalars

Function Documentation

bool isscalar ( ) const

Checks if the array contains only one element.

array a(1);
if(a.isscalar())
printf("a is a scalar\n"); //Will be printed as a has one element
array b(5);
array c(0);
if(b.isscalar() || c.isscalar())
; //statement not reachable as neither b nor c are scalars
Returns
True if the array contains one element. False otherwise