Fix for bug #3599: cv::FileStorage does not work for std::vector of user...

...-defined struct.
Note for reviewer: This modification changes the behaviour of the function write(). It may break a code that calls write() directly (that's an undocumented way).