Le 05/06/2016 à 01:01, Guillaume Munch a écrit :
Dear List,


I have recently started using c++11 features, and, one thing leading to
another, some cleaning of the tree happened. Apparently most of the
changes below are supported by old compilers (exceptions below), i.e.
MSVC 2012 and maybe MSVC 2010 (if lucky) since at least one developer
seemed to care about it.

Here is a patch I needed for my compilation. The const & for IconvProcessor is of course not needed, but it makes sense to me.

With this; I am still blocked in unicode.cpp on g++ 4.6. I understand that it might be because of incomplete C++11 support, but I'd nevertheless appreciate any insight. These gcc errors messages are just horrible (I replaced the basic_string template with string to get some sanity).

The important part is probably

../../../master/src/support/../support/unicode.h:48:7: erreur: ‘lyx::IconvProcessor::IconvProcessor(const lyx::IconvProcessor&)’ is implicitly deleted because the default definition would be ill-formed:

but then the cause of this problem is unclear to me.

JMarc


  CXX    unicode.o
In file included from /usr/include/c++/4.6/bits/stl_algobase.h:65:0,
                 from /usr/include/c++/4.6/memory:64,
from ../../../master/src/support/../support/unique_ptr.h:19,
                 from ../../../master/src/support/../support/unicode.h:18,
                 from ../../../master/src/support/unicode.cpp:15:
/usr/include/c++/4.6/bits/stl_pair.h: In constructor ‘constexpr std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = std::string, _T2 = lyx::IconvProcessor]’: /usr/include/c++/4.6/bits/stl_pair.h:267:72: instantiated from ‘std::pair<typename std::__decay_and_strip<_T1>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = const std::string&, _T2 = lyx::IconvProcessor, typename std::__decay_and_strip<_T2>::__type = lyx::IconvProcessor, typename std::__decay_and_strip<_T1>::__type = std::string]’
../../../master/src/support/unicode.cpp:265:60:   instantiated from here
/usr/include/c++/4.6/bits/stl_pair.h:104:31: erreur: use of deleted function ‘lyx::IconvProcessor::IconvProcessor(const lyx::IconvProcessor&)’
In file included from ../../../master/src/support/unicode.cpp:15:0:
../../../master/src/support/../support/unicode.h:48:7: erreur: ‘lyx::IconvProcessor::IconvProcessor(const lyx::IconvProcessor&)’ is implicitly deleted because the default definition would be ill-formed: ../../../master/src/support/../support/unicode.h:48:7: erreur: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = lyx::IconvProcessor::Handler, _Dp = std::default_delete<lyx::IconvProcessor::Handler>, std::unique_ptr<_Tp, _Dp> = std::unique_ptr<lyx::IconvProcessor::Handler>]’
/usr/include/c++/4.6/bits/unique_ptr.h:256:7: erreur: declared here
In file included from /usr/include/c++/4.6/bits/stl_algobase.h:65:0,
                 from /usr/include/c++/4.6/memory:64,
from ../../../master/src/support/../support/unique_ptr.h:19,
                 from ../../../master/src/support/../support/unicode.h:18,
                 from ../../../master/src/support/unicode.cpp:15:
/usr/include/c++/4.6/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = std::string, _U2 = lyx::IconvProcessor, _T1 = std::string, _T2 = lyx::IconvProcessor]’: /usr/include/c++/4.6/bits/stl_pair.h:267:72: instantiated from ‘std::pair<typename std::__decay_and_strip<_T1>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = const std::string&, _T2 = lyx::IconvProcessor, typename std::__decay_and_strip<_T2>::__type = lyx::IconvProcessor, typename std::__decay_and_strip<_T1>::__type = std::string]’
../../../master/src/support/unicode.cpp:265:60:   instantiated from here
/usr/include/c++/4.6/bits/stl_pair.h:137:40: erreur: use of deleted function ‘lyx::IconvProcessor::IconvProcessor(const lyx::IconvProcessor&)’ /usr/include/c++/4.6/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = std::string, _U2 = lyx::IconvProcessor, _T1 = const std::string, _T2 = lyx::IconvProcessor]’: /usr/include/c++/4.6/bits/stl_tree.h:139:49: instantiated from ‘std::_Rb_tree_node<_Val>::_Rb_tree_node(_Args&& ...) [with _Args = {std::pair<std::string, lyx::IconvProcessor>}, _Val = std::pair<const std::string, lyx::IconvProcessor>]’ /usr/include/c++/4.6/ext/new_allocator.h:114:4: instantiated from ‘void __gnu_cxx::new_allocator<_Tp>::construct(__gnu_cxx::new_allocator<_Tp>::pointer, _Args&& ...) [with _Args = {std::pair<std::string, lyx::IconvProcessor>}, _Tp = std::_Rb_tree_node<std::pair<const std::string, lyx::IconvProcessor> >, __gnu_cxx::new_allocator<_Tp>::pointer = std::_Rb_tree_node<std::pair<const std::string, lyx::IconvProcessor> >*]’ /usr/include/c++/4.6/bits/stl_tree.h:405:8: instantiated from ‘std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {std::pair<std::string, lyx::IconvProcessor>}, _Key = std::string, _Val = std::pair<const std::string, lyx::IconvProcessor>, _KeyOfValue = std::_Select1st<std::pair<const std::string, lyx::IconvProcessor> >, _Compare = std::less<std::string >, _Alloc = std::allocator<std::pair<const std::string, lyx::IconvProcessor> >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const std::string, lyx::IconvProcessor> >*]’ /usr/include/c++/4.6/bits/stl_tree.h:971:66: instantiated from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Base_ptr, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Base_ptr, _Arg&&) [with _Arg = std::pair<std::string, lyx::IconvProcessor>, _Key = std::string, _Val = std::pair<const std::string, lyx::IconvProcessor>, _KeyOfValue = std::_Select1st<std::pair<const std::string, lyx::IconvProcessor> >, _Compare = std::less<std::string >, _Alloc = std::allocator<std::pair<const std::string, lyx::IconvProcessor> >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::string, lyx::IconvProcessor> >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Base_ptr = const std::_Rb_tree_node_base*]’ /usr/include/c++/4.6/bits/stl_tree.h:1285:64: instantiated from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = std::pair<std::string, lyx::IconvProcessor>, _Key = std::string, _Val = std::pair<const std::string, lyx::IconvProcessor>, _KeyOfValue = std::_Select1st<std::pair<const std::string, lyx::IconvProcessor> >, _Compare = std::less<std::string >, _Alloc = std::allocator<std::pair<const std::string, lyx::IconvProcessor> >]’ /usr/include/c++/4.6/bits/stl_map.h:526:64: instantiated from ‘std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::__cxx1998::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator, bool> std::__cxx1998::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = std::pair<std::string, lyx::IconvProcessor>, <template-parameter-2-2> = void, _Key = std::string, _Tp = lyx::IconvProcessor, _Compare = std::less<std::string >, _Alloc = std::allocator<std::pair<const std::string, lyx::IconvProcessor> >, typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::__cxx1998::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator = std::_Rb_tree_iterator<std::pair<const std::string, lyx::IconvProcessor> >]’ /usr/include/c++/4.6/debug/map.h:223:46: instantiated from ‘std::pair<__gnu_debug::_Safe_iterator<typename std::__cxx1998::map<_Key, _Tp, _Compare, _Alloc>::iterator, std::__debug::map<_Key, _Tp, _Compare, _Allocator> >, bool> std::__debug::map<_Key, _Tp, _Compare, _Allocator>::insert(_Pair&&) [with _Pair = std::pair<std::string, lyx::IconvProcessor>, <template-parameter-2-2> = void, _Key = std::string, _Tp = lyx::IconvProcessor, _Compare = std::less<std::string >, _Allocator = std::allocator<std::pair<const std::string, lyx::IconvProcessor> >, typename std::__cxx1998::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const std::string, lyx::IconvProcessor> >]’
../../../master/src/support/unicode.cpp:265:61:   instantiated from here
/usr/include/c++/4.6/bits/stl_pair.h:137:40: erreur: use of deleted function ‘lyx::IconvProcessor::IconvProcessor(const lyx::IconvProcessor&)’

diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp
index 725320b..2fd2a20 100644
--- a/src/frontends/qt4/GuiPainter.cpp
+++ b/src/frontends/qt4/GuiPainter.cpp
@@ -29,6 +29,8 @@
 #include "support/lassert.h"
 #include "support/debug.h"
 
+#include <algorithm>
+
 #include <QPixmapCache>
 #include <QTextLayout>
 
diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp
index 454148f..3a8f075 100644
--- a/src/frontends/qt4/GuiProgressView.cpp
+++ b/src/frontends/qt4/GuiProgressView.cpp
@@ -24,6 +24,8 @@
 #include "support/convert.h"
 #include "support/debug.h"
 
+#include <algorithm>
+
 #include <QCheckBox>
 #include <QDebug>
 #include <QSettings>
diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp
index c6fd8f5..e7c2296 100644
--- a/src/support/unicode.cpp
+++ b/src/support/unicode.cpp
@@ -59,7 +59,7 @@ struct IconvProcessor::Handler {
 };
 
 
-IconvProcessor::IconvProcessor(std::string tocode, std::string fromcode)
+IconvProcessor::IconvProcessor(string const & tocode, string const & fromcode)
 	: tocode_(tocode), fromcode_(fromcode)
 {}
 
diff --git a/src/support/unicode.h b/src/support/unicode.h
index b296904..2853b7f 100644
--- a/src/support/unicode.h
+++ b/src/support/unicode.h
@@ -18,6 +18,7 @@
 #include "support/unique_ptr.h"
 
 #include <cstddef>
+#include <string>
 #include <vector>
 
 
@@ -54,7 +55,7 @@ class IconvProcessor
 	struct Handler;
 	unique_ptr<Handler> h_;
 public:
-	IconvProcessor(std::string tocode, std::string fromcode);
+	IconvProcessor(std::string const & tocode, std::string const & fromcode);
 	/// convert any data from \c fromcode to \c tocode unicode format.
 	/// \return the number of bytes of the converted output buffer.
 	int convert(char const * in_buffer, size_t in_size,

Reply via email to