diff --git a/docs/readme.en.html b/docs/readme.en.html
index 75327d8..d692352 100644
--- a/docs/readme.en.html
+++ b/docs/readme.en.html
@@ -123,7 +123,7 @@
$ make install
- Users can find a Perl bindings in bindings/perl/, in which the wrapper was generated by SWIG. To install the Perl bindings, run perl Makefile.PL and then make install. See also bindings/perl/sample.pl.
+ Users can find a Perl bindings in bindings/perl/, in which the wrapper was generated by SWIG. To install the Perl bindings, run perl Makefile.PL and then make install. See also bindings/perl/sample.pl.
@@ -134,7 +134,7 @@
$ python setup.py install
- Users can find a Python bindings in bindings/python/, in which the wrapper was generated by SWIG. To install the Python bindings, run python setup.py install. See also bindings/python/sample.py.
+ Users can find a Python bindings in bindings/python/, in which the wrapper was generated by SWIG. To install the Python bindings, run python setup.py install. See also bindings/python/sample.py.
@@ -146,7 +146,7 @@
$ make install
- Users can find a Ruby bindings in bindings/ruby/, in which the wrapper was generated by SWIG. To install the Ruby bindings, run ruby extconf.rb and then make install. See also bindings/ruby/sample.rb.
+ Users can find a Ruby bindings in bindings/ruby/, in which the wrapper was generated by SWIG. To install the Ruby bindings, run ruby extconf.rb and then make install. See also bindings/ruby/sample.rb.
@@ -160,7 +160,7 @@
https://github.com/kmike/marisa-trie/ an alternative Cython-based pip-installable Python bindings which is faster than the above Python bindings.
-
Node.js
+
Node.js
diff --git a/docs/readme.ja.html b/docs/readme.ja.html
index c5d7485..cb87815 100644
--- a/docs/readme.ja.html
+++ b/docs/readme.ja.html
@@ -126,7 +126,7 @@
$ make install
- SWIG による Perl バインディングが bindings/perl/ にあります.perl Makefile.PL により Makefile を作成し,make install を実行することでインストールできます.使い方については,bindings/perl/sample.pl を参考にしてください.
+ SWIG による Perl バインディングが bindings/perl/ にあります.perl Makefile.PL により Makefile を作成し,make install を実行することでインストールできます.使い方については,bindings/perl/sample.pl を参考にしてください.
@@ -137,7 +137,7 @@
$ python setup.py install
- SWIG による Python バインディングが bindings/python/ にあります.python setup.py install により インストールできます.使い方については,bindings/python/sample.py を参考にしてください.
+ SWIG による Python バインディングが bindings/python/ にあります.python setup.py install により インストールできます.使い方については,bindings/python/sample.py を参考にしてください.
@@ -149,7 +149,7 @@
$ make install
- SWIG による Ruby バインディングが bindings/ruby/ にあります.ruby extconf.rb により Makefile を作成し,make install を実行することでインストールできます.使い方については,bindings/ruby/sample.rb を参考にしてください.
+ SWIG による Ruby バインディングが bindings/ruby/ にあります.ruby extconf.rb により Makefile を作成し,make install を実行することでインストールできます.使い方については,bindings/ruby/sample.rb を参考にしてください.
@@ -736,12 +736,12 @@
- - 言語処理学会第 17 回年次大会(NLP2011)
+
- 言語処理学会第 17 回年次大会(NLP2011)
- - 言語処理学会年次大会の予稿集が公開されていて,MARISA に関する論文(F2-6.pdf)をダウンロードできます.
+ - 言語処理学会年次大会の予稿集が公開されていて,MARISA に関する論文(F2-6.pdf)をダウンロードできます.
- - 発表資料(Prefix/Patricia Trie の入れ子による辞書圧縮)
+
- 発表資料(Prefix/Patricia Trie の入れ子による辞書圧縮)
diff --git a/include/marisa/exception.h b/include/marisa/exception.h
index 508c6b8..88fce6e 100644
--- a/include/marisa/exception.h
+++ b/include/marisa/exception.h
@@ -19,7 +19,7 @@ class Exception : public std::exception {
Exception(const Exception &ex)
: std::exception(), filename_(ex.filename_), line_(ex.line_),
error_code_(ex.error_code_), error_message_(ex.error_message_) {}
- virtual ~Exception() throw() {}
+ virtual ~Exception() noexcept;
Exception &operator=(const Exception &rhs) {
filename_ = rhs.filename_;
diff --git a/lib/marisa/Makefile.am b/lib/marisa/Makefile.am
index e42408b..e7c3ad6 100644
--- a/lib/marisa/Makefile.am
+++ b/lib/marisa/Makefile.am
@@ -14,6 +14,7 @@ libmarisa_la_LIBADD = \
grimoire/vector/libvector.la
libmarisa_la_SOURCES = \
+ exception.cc \
keyset.cc \
agent.cc \
trie.cc
diff --git a/lib/marisa/exception.cc b/lib/marisa/exception.cc
new file mode 100644
index 0000000..cb5acde
--- /dev/null
+++ b/lib/marisa/exception.cc
@@ -0,0 +1,21 @@
+#include "marisa/exception.h"
+
+namespace marisa {
+
+/**
+ * This is defined here for the following reasons.
+ *
+ * 1. Virtual destructors are best not defined in a header to be included in many compilation units.
+ * Defining it here in a single compilation unit prevents multiple vtables from being generated and causing
+ * a compiler to be confused as to which is the true vtable, like with full link time optimization.
+ * By reducing the number of vtable instances, you also reduce the size of your library or application.
+ * You can see warnings around this with the -Wweak-vtables compiler option. Such issues may not be seen till runtime.
+ * Using the default keyword on the destructor is the same as defining it in the header.
+ *
+ * 2. Exceptions can not be thrown from destructors. When an exception is thrown from a destructor
+ * while the stack is unwinding from another thrown exception, then the program will crash instead
+ * of throwing the exception. See https://isocpp.org/wiki/faq/exceptions#ctor-exceptions
+ */
+Exception::~Exception() noexcept {}
+
+}