--- /dev/null
+#ifndef __NEST_DOMAIN_H__
+#define __NEST_DOMAIN_H__
+
+#include "nest/Closure.h"
+
+namespace nest
+{
+
+class Domain
+{
+public:
+ Domain() = default;
+
+public:
+ Domain(const DomainID &id) : _id{id}
+ {
+ // DO NOTHING
+ }
+
+public:
+ Domain(const Domain &) = default;
+
+public:
+ template <typename... Args> Closure operator()(Args &&... indices)
+ {
+ return Closure{_id, std::forward<Args>(indices)...};
+ }
+
+public:
+ const DomainID &id(void) const { return _id; }
+
+private:
+ DomainID const _id;
+};
+
+} // namespace nest
+
+#endif // __NEST_DOMAIN_H__
#include "nest/expr/Node.h"
#include <vector>
+#include <initializer_list>
#include <memory>
class Subscript
{
public:
- template <typename... Args>
- Subscript(Args &&... indicies) : _indices{std::forward<Args>(indicies)...}
+ Subscript(std::initializer_list<std::shared_ptr<Node>> indices) : _indices{indices}
{
// DO NOTHING
}
--- /dev/null
+#include "nest/Domain.h"
+
+#include <gtest/gtest.h>
+
+namespace
+{
+namespace expr
+{
+struct DummyNode final : public nest::expr::Node
+{
+};
+} // namespace expr
+} // namespace
+
+// NOTE Build failed when DOMAIN is used instead of _DOMAIN
+TEST(_DOMAIN, base_usecase)
+{
+ nest::DomainID dom_id{0};
+ nest::Domain dom{dom_id};
+
+ nest::Closure clo = dom(std::make_shared<::expr::DummyNode>());
+
+ ASSERT_EQ(clo.id(), dom_id);
+ ASSERT_EQ(clo.sub().rank(), 1);
+}