          i < (n); \
          i += blockDim.x * gridDim.x)
 
-template <typename T, int ndim>
+template <typename T, int _ndim>
 class CArray {
+public:
+  static const int ndim = _ndim;
 private:
   T* data_;
   ptrdiff_t size_;

  ptrdiff_t size_;

public:
  __device__ int size() const {
    return size_;
  }

  ptrdiff_t size_;

public:
  static const int ndim = 0;

  __device__ int size() const {
    return size_;
  }
