我有S
的以下数组IntVar[]
:
IntVar[] S = model.intVarArray("Flights Schedule", 18, 0, 19);
我还有ArrayList
Integer
fromHome
,名为ArrayList<Integer> fromHome = [1, 2, 4];
:
fromHome
S[0]
稍后会在程序中派生。
我想将fromHome
的域限制为仅包含template<typename... Args>
std::string bufcat(Args&&... args) {
std::stringstream ss;
auto iteration = [&ss](auto&& item) { ss << std::forward<decltype(item)>(item); };
(void)std::initializer_list<int> {(
iteration(std::forward<Args>(args))
, 0)..., 0};
return ss.str();
}
中的值而不包含任何其他内容。我怎样才能做到这一点?谢谢!
答案 0 :(得分:1)
我找到了一种使用func retrieveCoreDataSpecies () {
let context = (UIApplication.shared.delegate
as! AppDelegate).persistentContainer.viewContext
let entity = NSEntityDescription.entity(
forEntityName: "SpeciesDetailData", in: context)
let request: NSFetchRequest<SpeciesDetailData> = SpeciesDetailData.fetchRequest()
request.entity = entity
let pred = NSPredicate(format: "speciesName = %@", specieDetail.specie)
request.predicate = pred
do {
let results = try context.fetch(request as!
NSFetchRequest<NSFetchRequestResult>)
if (results.count > 0) {
let match = results[0] as! NSManagedObject
if speciesDetailData?.commonName != nil {
ckCommonNameTextField.text = match.value(forKey: "commonName") as? String
} else {
}
if ckNotesTextView.text == "" || ckNotesTextView.text == nil {
} else {
ckNotesTextView.text = match.value(forKey: "speciesNote") as! String
}
}
} catch let error {
print("Count not fetch \(error), \(error.localizedDescription)")
}
}
约束的方法,如下所示:
member