added functions in SGNDArray

@iglesias @hushell
Could you help me to check this patch? Thanks!
I wouldn't suggest this method inline as it contains an if and a loop (i.e. is not just a one-liner). Also, I prefer to keep implementation in the cpp files.