From b96762a48ff78ba39563301e3f2be9a9b7bf5ef3 Mon Sep 17 00:00:00 2001 From: Koji Miyazato Date: Thu, 13 Mar 2014 19:41:13 +0900 Subject: [PATCH] Fix for bug #3599: cv::FileStorage does not work for std::vector of user-defined struct. --- modules/core/include/opencv2/core/persistence.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/include/opencv2/core/persistence.hpp b/modules/core/include/opencv2/core/persistence.hpp index 8f515c54dd..e00c849400 100644 --- a/modules/core/include/opencv2/core/persistence.hpp +++ b/modules/core/include/opencv2/core/persistence.hpp @@ -697,11 +697,11 @@ void write(FileStorage& fs, const String& name, const Range& r ) template static inline void write( FileStorage& fs, const String& name, const std::vector<_Tp>& vec ) { - internal::WriteStructContext ws(fs, name, FileNode::SEQ+(DataType<_Tp>::fmt != 0 ? FileNode::FLOW : 0)); + fs << (DataType<_Tp>::fmt != 0 ? "[:" : "["); write(fs, vec); + fs << "]"; } - static inline void read(const FileNode& node, bool& value, bool default_value) {