$在MiniZinc中是什么意思?
What does $ mean in MiniZinc?
我看到 $ 在 MiniZinc Handbook (mostly in the Reference Manual 部分的不同地方使用),但我找不到定义。有人会向我解释一下吗?谢谢
MiniZinc 支持三种基本类型,{int, float, bool }
。该文档使用 $T
作为此集合中包含的任何类型的占位符,因此无需为每个函数的签名提供三个版本,每个基本类型一个。
我猜想这种语法风格是受 shell
的启发,其中符号 $T
用于取消对名称 T
的引用,它通常会产生对应于 T
的值=27=]位置。
也可以将 $T
视为 C++
语言中的 模板 typename/class
,实现完全相同的目的。
// MiniZinc Docs
set of $U: array_union(array[$T] of set of $U)
// C++-like style
template <class T, class U>
set<U> array_union(map< T, set<U> >);
我看到 $ 在 MiniZinc Handbook (mostly in the Reference Manual 部分的不同地方使用),但我找不到定义。有人会向我解释一下吗?谢谢
MiniZinc 支持三种基本类型,{int, float, bool }
。该文档使用 $T
作为此集合中包含的任何类型的占位符,因此无需为每个函数的签名提供三个版本,每个基本类型一个。
我猜想这种语法风格是受 shell
的启发,其中符号 $T
用于取消对名称 T
的引用,它通常会产生对应于 T
的值=27=]位置。
也可以将 $T
视为 C++
语言中的 模板 typename/class
,实现完全相同的目的。
// MiniZinc Docs
set of $U: array_union(array[$T] of set of $U)
// C++-like style
template <class T, class U>
set<U> array_union(map< T, set<U> >);