   typedef ptrdiff_t index_t[ndim];
 
 public:
+  // Constructor supports pointers or initializer lists and index is optional
+  //    CIndexer<3> ca(shape, index);
+  //    CIndexer<3> ca({1, 2, 3}, {0, 1, 1});
+  //    CIndexer<3> ca = {1, 2, 3};
+  // Initializer lists are only supported with -std=c++11 or higher.
+
+  template <typename Int>
+  __device__ explicit CIndexer(const Int* shape)
+      : size_(1) {
+    for (int i = 0; i < _ndim; i++) {
+      this->size_ *= shape[i];
+      this->shape_[i] = shape[i];
+      this->index_[i] = 0;
+    }
+  }
+
+  template <typename Int1, typename Int2>
+  __device__ CIndexer(const Int1* shape, const Int2* index)
+      : size_(1) {
+    for (int i = 0; i < _ndim; i++) {
+      this->size_ *= shape[i];
+      this->shape_[i] = shape[i];
+      this->index_[i] = index[i];
+    }
+  }
+
+#if __cplusplus >= 201103
+  template <typename Int>
+  __device__ CIndexer(const std::initializer_list<Int> shape)
+      : CIndexer(shape.begin())
+  {
+    assert(shape.size() == _ndim);
+  }
+
+  template <typename Int1, typename Int2>
+  __device__ CIndexer(const std::initializer_list<Int1> shape,
+                      const std::initializer_list<Int2> index)
+      : CIndexer(shape.begin(), index.begin())
+  {
+    assert(shape.size() == _ndim);
+    assert(index.size() == _ndim);
+  }
+#endif
+
   __device__ ptrdiff_t size() const {
     return size_;
   }

public:
  static const int ndim = 0;

  __device__ ptrdiff_t size() const {
    return size_;
  }

public:
  static const int ndim = 0;

  __device__ CIndexer() : size_(1) { }

  template <typename Int>
  __device__ explicit CIndexer(Int size) : size_(size) { }

  // These constructors are just to match the non-0-dim constructors
  template <typename Int>
  __device__ explicit CIndexer(const Int* shape) : size_(1) { }

  template <typename Int1, typename Int2>
  __device__ CIndexer(const Int1* shape, const Int2* strides)
      : size_(1) { }

#if __cplusplus >= 201103
  __device__ CIndexer(const std::initializer_list<int> shape)
      : size_(1)
  {
    assert(shape.size() == 0);
  }

  __device__ CIndexer(const std::initializer_list<int> shape,
                      const std::initializer_list<int> index)
      : size_(1)
  {
    assert(shape.size() == 0);
    assert(index.size() == 0);
  }
#endif

  __device__ ptrdiff_t size() const {
    return size_;
  }
