I like them, but a couple remarks.

* patch 2: broken indentation

                if (!current_view_
-                   || (!lyxrc.open_buffers_in_tabs
-                       && current_view_->documentBufferView() != 0
-                       && !is_open)) {
+                       || (!lyxrc.open_buffers_in_tabs
+                               && current_view_->documentBufferView() != 0
+                               && !is_open)) {


I "broke" it because now condition and nested block have same level of indentation and it is hard to see where they are separated. Comment helps but still...


* concerning std::any, currently with autoconf we enforce c++14 when available. 
I could move to C++17 instead (the idea is to avoid caring with code that 
becomes wrong with new standard when we do not use the standard).

I'm not sure if I understood the last phrase correctly, but probably `boost::any` have no problems when compiling in newer standard modes. So please decide what is the best.


Two ideas for more cleanups:

1/ we still have a few for_each() uses.

2/ if we require gcc 4.9, then we can use std::regex. I think there was a need 
of boost:regex on windows side, is it still true ?


JMarc

Yes, I've already thought about std::regex. It compiles flawlessly with attached patch on Windows/MinGW64/GCC7. Now we need some testing on MSVC. Probably Eugene can help here.

Yuriy
From 2586b128b73d0808ca6335f2dd4d6a37927b81dd Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.ska...@gmail.com>
Date: Sat, 21 Nov 2020 20:11:23 +0200
Subject: [PATCH] Always use std::regex

Since now minimum supported GCC is 4.9.
---
 src/support/regex.h | 45 ++++++++++++++++-----------------------------
 1 file changed, 16 insertions(+), 29 deletions(-)

diff --git a/src/support/regex.h b/src/support/regex.h
index 96498708fc..491044ca1f 100644
--- a/src/support/regex.h
+++ b/src/support/regex.h
@@ -12,45 +12,32 @@
 #ifndef LYX_REGEXP_H
 #define LYX_REGEXP_H
 
-#ifdef LYX_USE_STD_REGEX
-#  include <regex>
-// <regex> in gcc is unusable in versions less than 4.9.0
-// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
-#  define LR_NS std
-#else
-#  include <boost/regex.hpp>
-#  define LR_NS boost
-#endif
+#include <regex>
 
 namespace lyx {
-using LR_NS::regex;
-using LR_NS::regex_match;
-using LR_NS::regex_replace;
-using LR_NS::regex_search;
-using LR_NS::sregex_iterator;
-using LR_NS::smatch;
-using LR_NS::basic_regex;
-using LR_NS::regex_error;
-using LR_NS::match_results;
+
+using std::regex;
+using std::regex_match;
+using std::regex_replace;
+using std::regex_search;
+using std::sregex_iterator;
+using std::smatch;
+using std::basic_regex;
+using std::regex_error;
+using std::match_results;
 
 namespace regex_constants
 {
-using namespace LR_NS::regex_constants;
-using LR_NS::regex_constants::match_flag_type;
+
+using namespace std::regex_constants;
+using std::regex_constants::match_flag_type;
+
 } // namespace regex_constants
 
 } // namespace lyx
 
-#undef LR_NS
-
-#ifdef LYX_USE_STD_REGEX
 // Match Begin and End of String when using ECMAScript (default std::regex)
 #define REGEX_BOS "^"
 #define REGEX_EOS "$"
-#else
-// Match Begin and End of String when using Perl RE (default boost::regex)
-#define REGEX_BOS "\\`"
-#define REGEX_EOS "\\'"
-#endif
 
-#endif
+#endif // LYX_REGEXP_H
-- 
2.28.0.windows.1

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to