summaryrefslogtreecommitdiffstats
path: root/indexlib
diff options
context:
space:
mode:
Diffstat (limited to 'indexlib')
-rw-r--r--indexlib/CMakeLists.txt1
-rw-r--r--indexlib/boost-compat/config/auto_link.h58
-rw-r--r--indexlib/boost-compat/config/compiler/borland.h177
-rw-r--r--indexlib/boost-compat/config/compiler/gcc.h4
-rw-r--r--indexlib/boost-compat/config/compiler/metrowerks.h97
-rw-r--r--indexlib/boost-compat/config/requires_threads.h15
-rw-r--r--indexlib/boost-compat/config/select_compiler_config.h15
-rw-r--r--indexlib/boost-compat/config/select_stdlib_config.h4
-rw-r--r--indexlib/boost-compat/config/stdlib/dinkumware.h6
-rw-r--r--indexlib/boost-compat/config/stdlib/libstdcpp3.h6
-rw-r--r--indexlib/boost-compat/config/stdlib/msl.h54
-rw-r--r--indexlib/boost-compat/config/stdlib/roguewave.h8
-rw-r--r--indexlib/boost-compat/config/stdlib/stlport.h35
-rw-r--r--indexlib/boost-compat/config/suffix.h4
-rw-r--r--indexlib/boost-compat/intrusive_ptr.h9
-rw-r--r--indexlib/boost-compat/scoped_ptr.h9
-rw-r--r--indexlib/boost-compat/shared_ptr.h46
-rw-r--r--indexlib/boost-compat/weak_ptr.h1
-rw-r--r--indexlib/compressed.cpp2
-rw-r--r--indexlib/create.cpp22
-rw-r--r--indexlib/create.h4
-rw-r--r--indexlib/ifile.cpp12
-rw-r--r--indexlib/ifile.h8
-rw-r--r--indexlib/index.h4
-rw-r--r--indexlib/leafdatavector.cpp2
-rw-r--r--indexlib/main.cpp6
-rw-r--r--indexlib/mempool.h6
-rw-r--r--indexlib/mempool.tcc4
-rw-r--r--indexlib/quotes.cpp6
-rw-r--r--indexlib/quotes.h2
-rw-r--r--indexlib/result.h4
-rw-r--r--indexlib/tests/create-test.cpp4
-rw-r--r--indexlib/tests/mempool-test.cpp4
-rw-r--r--indexlib/tests/tokenizer-test.cpp12
-rw-r--r--indexlib/tokenizer.cpp6
-rw-r--r--indexlib/tokenizer.h2
36 files changed, 81 insertions, 578 deletions
diff --git a/indexlib/CMakeLists.txt b/indexlib/CMakeLists.txt
index f89e4f1a..6f5a42e5 100644
--- a/indexlib/CMakeLists.txt
+++ b/indexlib/CMakeLists.txt
@@ -13,7 +13,6 @@ project( indexlib )
include( ConfigureChecks.cmake )
-string( REPLACE "-include tqt.h" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include compat.h ${USE_EXCEPTIONS}" )
include_directories(
diff --git a/indexlib/boost-compat/config/auto_link.h b/indexlib/boost-compat/config/auto_link.h
index c6d9bc90..e3bdc41d 100644
--- a/indexlib/boost-compat/config/auto_link.h
+++ b/indexlib/boost-compat/config/auto_link.h
@@ -7,7 +7,7 @@
* LOCATION: see http://www.boost.org for most recent version.
* FILE auto_link.h
* VERSION see <boost/version.hpp>
- * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
+ * DESCRIPTION: Automatic library inclusion for Microsoft compilers.
*/
/*************************************************************************
@@ -29,7 +29,7 @@ has no include guards - so be sure to include it only once from your library!
Algorithm:
~~~~~~~~~~
-Libraries for Borland and Microsoft compilers are automatically
+Libraries for Microsoft compilers are automatically
selected here, the name of the lib is selected according to the following
formula:
@@ -70,7 +70,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# ifndef BOOST_CONFIG_H
# include <boost/config.hpp>
# endif
-#elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
+#elif defined(_MSC_VER) && !defined(__EDG_VERSION__)
//
// C language compatability (no, honestly)
//
@@ -82,8 +82,6 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// Only include what follows for known and supported compilers:
//
#if defined(BOOST_MSVC) \
- || defined(__BORLANDC__) \
- || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
#ifndef BOOST_VERSION_H
@@ -125,26 +123,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// vc80:
# define BOOST_LIB_TOOLSET "vc80"
-#elif defined(__BORLANDC__)
-
- // CBuilder 6:
-# define BOOST_LIB_TOOLSET "bcb"
-
#elif defined(__ICL)
// Intel C++, no version number:
# define BOOST_LIB_TOOLSET "iw"
-#elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
-
- // Metrowerks CodeWarrior 8.x
-# define BOOST_LIB_TOOLSET "cw8"
-
-#elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
-
- // Metrowerks CodeWarrior 9.x
-# define BOOST_LIB_TOOLSET "cw9"
-
#endif
//
@@ -156,7 +139,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# define BOOST_LIB_THREAD_OPT
#endif
-#if defined(_MSC_VER) || defined(__MWERKS__)
+#if defined(_MSC_VER)
# ifdef _DLL
@@ -232,37 +215,6 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# endif
-#elif defined(__BORLANDC__)
-
-//
-// figure out whether we want the debug builds or not:
-//
-#pragma defineonoption BOOST_BORLAND_DEBUG -v
-//
-// sanity check:
-//
-#if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
-#error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form"
-#endif
-
-# ifdef _RTLDLL
-
-# ifdef BOOST_BORLAND_DEBUG
-# define BOOST_LIB_RT_OPT "-d"
-# else
-# define BOOST_LIB_RT_OPT
-# endif
-
-# else
-
-# ifdef BOOST_BORLAND_DEBUG
-# define BOOST_LIB_RT_OPT "-sd"
-# else
-# define BOOST_LIB_RT_OPT "-s"
-# endif
-
-# endif
-
#endif
//
@@ -296,7 +248,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
#endif
-#endif // _MSC_VER || __BORLANDC__
+#endif // _MSC_VER
//
// finally undef any macros we may have set:
diff --git a/indexlib/boost-compat/config/compiler/borland.h b/indexlib/boost-compat/config/compiler/borland.h
deleted file mode 100644
index 531691ef..00000000
--- a/indexlib/boost-compat/config/compiler/borland.h
+++ /dev/null
@@ -1,177 +0,0 @@
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright David Abrahams 2002 - 2003.
-// (C) Copyright Aleksey Gurtovoy 2002.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// Borland C++ compiler setup:
-
-// Version 5.0 and below:
-# if __BORLANDC__ <= 0x0550
-// Borland C++Builder 4 and 5:
-# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-# if __BORLANDC__ == 0x0550
-// Borland C++Builder 5, command-line compiler 5.5:
-# define BOOST_NO_OPERATORS_IN_NAMESPACE
-# endif
-# endif
-
-// Version 5.51 and below:
-#if (__BORLANDC__ <= 0x551)
-# define BOOST_NO_CV_SPECIALIZATIONS
-# define BOOST_NO_CV_VOID_SPECIALIZATIONS
-# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-# define BOOST_NO_DEDUCED_TYPENAME
-// workaround for missing WCHAR_MAX/WCHAR_MIN:
-#include <climits>
-#include <cwchar>
-#ifndef WCHAR_MAX
-# define WCHAR_MAX 0xffff
-#endif
-#ifndef WCHAR_MIN
-# define WCHAR_MIN 0
-#endif
-#endif
-
-#if (__BORLANDC__ <= 0x564)
-# define BOOST_NO_SFINAE
-#endif
-
-// Version 7.0 (Kylix) and below:
-#if (__BORLANDC__ <= 0x570)
-# define BOOST_NO_INTEGRAL_INT64_T
-# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
-# define BOOST_NO_PRIVATE_IN_AGGREGATE
-# define BOOST_NO_USING_TEMPLATE
-# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
-# define BOOST_NO_TEMPLATE_TEMPLATES
-# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
-# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
- // we shouldn't really need this - but too many things choke
- // without it, this needs more investigation:
-# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
-# ifdef NDEBUG
- // fix broken <cstring> so that Boost.test works:
-# include <cstring>
-# undef strcmp
-# endif
-
-//
-// new bug in 5.61:
-#if (__BORLANDC__ >= 0x561) && (__BORLANDC__ <= 0x570)
- // this seems to be needed by the command line compiler, but not the IDE:
-# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
-#endif
-
-# ifdef _WIN32
-# define BOOST_NO_SWPRINTF
-# elif defined(linux) || defined(__linux__) || defined(__linux)
- // we should really be able to do without this
- // but the wcs* functions aren't imported into std::
-# define BOOST_NO_STDC_NAMESPACE
- // _CPPUNWIND doesn't get automatically set for some reason:
-# pragma defineonoption BOOST_CPPUNWIND -x
-# endif
-#endif
-
-//
-// Post 0x561 we have long long and stdint.h:
-#if __BORLANDC__ >= 0x561
-# ifndef __NO_LONG_LONG
-# define BOOST_HAS_LONG_LONG
-# endif
- // On non-Win32 platforms let the platform config figure this out:
-# ifdef _WIN32
-# define BOOST_HAS_STDINT_H
-# endif
-#endif
-
-// Borland C++Builder 6 defaults to using STLPort. If _USE_OLD_RW_STL is
-// defined, then we have 0x560 or greater with the Rogue Wave implementation
-// which presumably has the std::DBL_MAX bug.
-#if ((__BORLANDC__ >= 0x550) && (__BORLANDC__ < 0x560)) || defined(_USE_OLD_RW_STL)
-// <climits> is partly broken, some macros define symbols that are really in
-// namespace std, so you end up having to use illegal constructs like
-// std::DBL_MAX, as a fix we'll just include float.h and have done with:
-#include <float.h>
-#endif
-//
-// __int64:
-//
-#if (__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__)
-# define BOOST_HAS_MS_INT64
-#endif
-//
-// check for exception handling support:
-//
-#if !defined(_CPPUNWIND) && !defined(BOOST_CPPUNWIND) && !defined(__EXCEPTIONS)
-# define BOOST_NO_EXCEPTIONS
-#endif
-//
-// all versions have a <dirent.h>:
-//
-#ifndef __STRICT_ANSI__
-# define BOOST_HAS_DIRENT_H
-#endif
-//
-// all versions support __declspec:
-//
-#ifndef __STRICT_ANSI__
-# define BOOST_HAS_DECLSPEC
-#endif
-//
-// ABI fixing headers:
-//
-#if __BORLANDC__ < 0x600 // not implemented for version 6 compiler yet
-#ifndef BOOST_ABI_PREFIX
-# define BOOST_ABI_PREFIX "boost/config/abi/borland_prefix.hpp"
-#endif
-#ifndef BOOST_ABI_SUFFIX
-# define BOOST_ABI_SUFFIX "boost/config/abi/borland_suffix.hpp"
-#endif
-#endif
-//
-// Disable Win32 support in ANSI mode:
-//
-#if __BORLANDC__ < 0x600
-# pragma defineonoption BOOST_DISABLE_WIN32 -A
-#elif defined(__STRICT_ANSI__)
-# define BOOST_DISABLE_WIN32
-#endif
-//
-// MSVC compatibility mode does some nasty things:
-//
-#if defined(_MSC_VER) && (_MSC_VER <= 1200)
-# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
-# define BOOST_NO_VOID_RETURNS
-#endif
-
-#define BOOST_COMPILER "Borland C++ version " BOOST_STRINGIZE(__BORLANDC__)
-
-//
-// versions check:
-// we don't support Borland prior to version 5.4:
-#if __BORLANDC__ < 0x540
-# error "Compiler not supported or configured - please reconfigure"
-#endif
-//
-// last known and checked version is 1536 (Builder X preview):
-#if (__BORLANDC__ > 1536)
-# if defined(BOOST_ASSERT_CONFIG)
-# error "Unknown compiler version - please run the configure tests and report the results"
-# else
-# pragma message( "Unknown compiler version - please run the configure tests and report the results")
-# endif
-#endif
-
-
-
-
-
-
-
-
diff --git a/indexlib/boost-compat/config/compiler/gcc.h b/indexlib/boost-compat/config/compiler/gcc.h
index 2c5ad198..4be7f408 100644
--- a/indexlib/boost-compat/config/compiler/gcc.h
+++ b/indexlib/boost-compat/config/compiler/gcc.h
@@ -13,10 +13,6 @@
// GNU C++ compiler setup:
-# if __GNUC__ == 2 && __GNUC_MINOR__ == 91
- // egcs 1.1 won't parse shared_ptr.h without this:
-# define BOOST_NO_AUTO_PTR
-# endif
# if __GNUC__ == 2 && __GNUC_MINOR__ < 95
//
// Prior to gcc 2.95 member templates only partly
diff --git a/indexlib/boost-compat/config/compiler/metrowerks.h b/indexlib/boost-compat/config/compiler/metrowerks.h
deleted file mode 100644
index a74cadef..00000000
--- a/indexlib/boost-compat/config/compiler/metrowerks.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// (C) Copyright John Maddock 2001.
-// (C) Copyright Darin Adler 2001.
-// (C) Copyright Peter Dimov 2001.
-// (C) Copyright David Abrahams 2001 - 2002.
-// (C) Copyright Beman Dawes 2001 - 2003.
-// (C) Copyright Stefan Slapeta 2004.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// Metrowerks C++ compiler setup:
-
-// locale support is disabled when linking with the dynamic runtime
-# ifdef _MSL_NO_LOCALE
-# define BOOST_NO_STD_LOCALE
-# endif
-
-# if __MWERKS__ <= 0x2301 // 5.3
-# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING
-# define BOOST_NO_POINTER_TO_MEMBER_CONST
-# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
-# define BOOST_NO_MEMBER_TEMPLATE_KEYWORD
-# endif
-
-# if __MWERKS__ <= 0x2401 // 6.2
-//# define BOOST_NO_FUNCTION_TEMPLATE_ORDERING
-# endif
-
-# if(__MWERKS__ <= 0x2407) // 7.x
-# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
-# define BOOST_NO_UNREACHABLE_RETURN_DETECTION
-# endif
-
-# if(__MWERKS__ <= 0x3003) // 8.x
-# define BOOST_NO_SFINAE
-# endif
-
-# if(__MWERKS__ <= 0x3204) // 9.3
-# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
-# endif
-
-#if !__option(wchar_type)
-# define BOOST_NO_INTRINSIC_WCHAR_T
-#endif
-
-#if !__option(exceptions)
-# define BOOST_NO_EXCEPTIONS
-#endif
-
-#if (__INTEL__ && _WIN32) || (__POWERPC__ && macintosh)
-# if __MWERKS__ == 0x3000
-# define BOOST_COMPILER_VERSION 8.0
-# elif __MWERKS__ == 0x3001
-# define BOOST_COMPILER_VERSION 8.1
-# elif __MWERKS__ == 0x3002
-# define BOOST_COMPILER_VERSION 8.2
-# elif __MWERKS__ == 0x3003
-# define BOOST_COMPILER_VERSION 8.3
-# elif __MWERKS__ == 0x3200
-# define BOOST_COMPILER_VERSION 9.0
-# elif __MWERKS__ == 0x3201
-# define BOOST_COMPILER_VERSION 9.1
-# elif __MWERKS__ == 0x3202
-# define BOOST_COMPILER_VERSION 9.2
-# elif __MWERKS__ == 0x3204
-# define BOOST_COMPILER_VERSION 9.3
-# else
-# define BOOST_COMPILER_VERSION __MWERKS__
-# endif
-#else
-# define BOOST_COMPILER_VERSION __MWERKS__
-#endif
-
-#define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
-
-//
-// versions check:
-// we don't support Metrowerks prior to version 5.3:
-#if __MWERKS__ < 0x2301
-# error "Compiler not supported or configured - please reconfigure"
-#endif
-//
-// last known and checked version:
-#if (__MWERKS__ > 0x3204)
-# if defined(BOOST_ASSERT_CONFIG)
-# error "Unknown compiler version - please run the configure tests and report the results"
-# endif
-#endif
-
-
-
-
-
-
-
diff --git a/indexlib/boost-compat/config/requires_threads.h b/indexlib/boost-compat/config/requires_threads.h
index 03259ae9..ffa75e9d 100644
--- a/indexlib/boost-compat/config/requires_threads.h
+++ b/indexlib/boost-compat/config/requires_threads.h
@@ -50,18 +50,6 @@
// SGI MIPSpro C++
# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -D_SGI_MP_SOURCE"
-#elif defined __DECCXX
-// Compaq Tru64 Unix cxx
-# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread"
-
-#elif defined __BORLANDC__
-// Borland
-# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -tWM"
-
-#elif defined __MWERKS__
-// Metrowerks CodeWarrior
-# error "Compiler threading support is not turned on. Please set the correct command line options for threading: either -runtime sm, -runtime smd, -runtime dm, or -runtime dmd"
-
#elif defined __SUNPRO_CC
// Sun Workshop Compiler C++
# error "Compiler threading support is not turned on. Please set the correct command line options for threading: -mt"
@@ -77,8 +65,7 @@
#elif defined _MSC_VER
// Microsoft Visual C++
//
-// Must remain the last #elif since some other vendors (Metrowerks, for
-// example) also #define _MSC_VER
+// Must remain the last #elif since some other vendors may also #define _MSC_VER
# error "Compiler threading support is not turned on. Please set the correct command line options for threading: either /MT /MTd /MD or /MDd"
#else
diff --git a/indexlib/boost-compat/config/select_compiler_config.h b/indexlib/boost-compat/config/select_compiler_config.h
index 3453f1a3..00b4de96 100644
--- a/indexlib/boost-compat/config/select_compiler_config.h
+++ b/indexlib/boost-compat/config/select_compiler_config.h
@@ -36,22 +36,10 @@
// SGI MIPSpro C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp"
-#elif defined __DECCXX
-// Compaq Tru64 Unix cxx
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp"
-
#elif defined __ghs
// Greenhills C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp"
-#elif defined __BORLANDC__
-// Borland
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp"
-
-#elif defined __MWERKS__
-// Metrowerks CodeWarrior
-# define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp"
-
#elif defined __SUNPRO_CC
// Sun Workshop Compiler C++
# define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp"
@@ -71,8 +59,7 @@
#elif defined _MSC_VER
// Microsoft Visual C++
//
-// Must remain the last #elif since some other vendors (Metrowerks, for
-// example) also #define _MSC_VER
+// Must remain the last #elif since some other vendors may also #define _MSC_VER
# define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp"
#elif defined (BOOST_ASSERT_CONFIG)
diff --git a/indexlib/boost-compat/config/select_stdlib_config.h b/indexlib/boost-compat/config/select_stdlib_config.h
index b7bf5914..a061c5be 100644
--- a/indexlib/boost-compat/config/select_stdlib_config.h
+++ b/indexlib/boost-compat/config/select_stdlib_config.h
@@ -41,10 +41,6 @@
// generic SGI STL
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp"
-#elif defined(__MSL_CPP__)
-// MSL standard lib:
-# define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp"
-
#elif defined(__IBMCPP__)
// take the default VACPP std lib
# define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp"
diff --git a/indexlib/boost-compat/config/stdlib/dinkumware.h b/indexlib/boost-compat/config/stdlib/dinkumware.h
index aa214fc1..a3c4f091 100644
--- a/indexlib/boost-compat/config/stdlib/dinkumware.h
+++ b/indexlib/boost-compat/config/stdlib/dinkumware.h
@@ -22,7 +22,7 @@
#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
// full dinkumware 3.06 and above
// fully conforming provided the compiler supports it:
-# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(__BORLANDC__) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h
+# if !(defined(_GLOBAL_USING) && (_GLOBAL_USING+0 > 0)) && !defined(_STD) && !(defined(__ICC) && (__ICC >= 700)) // can be defined in yvals.h
# define BOOST_NO_STDC_NAMESPACE
# endif
# if !(defined(_HAS_MEMBER_TEMPLATES_REBIND) && (_HAS_MEMBER_TEMPLATES_REBIND+0 > 0)) && !(defined(_MSC_VER) && (_MSC_VER > 1300)) && defined(BOOST_MSVC)
@@ -66,12 +66,12 @@
// the same applies to other compilers that sit on top
// of vc7.1 (Intel and Comeau):
//
-#if defined(_MSC_VER) && (_MSC_VER >= 1310) && !defined(__BORLANDC__)
+#if defined(_MSC_VER) && (_MSC_VER >= 1310)
# define BOOST_STD_EXTENSION_NAMESPACE stdext
#endif
-#if (defined(_MSC_VER) && (_MSC_VER <= 1300) && !defined(__BORLANDC__)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306)
+#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306)
// if we're using a dinkum lib that's
// been configured for VC6/7 then there is
// no iterator traits (true even for icl)
diff --git a/indexlib/boost-compat/config/stdlib/libstdcpp3.h b/indexlib/boost-compat/config/stdlib/libstdcpp3.h
index 99e711ce..bbf29559 100644
--- a/indexlib/boost-compat/config/stdlib/libstdcpp3.h
+++ b/indexlib/boost-compat/config/stdlib/libstdcpp3.h
@@ -22,12 +22,6 @@
# define BOOST_NO_STD_WSTREAMBUF
#endif
-#if defined(__osf__) && !defined(_REENTRANT) && defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
-// GCC 3.4 on Tru64 forces the definition of _REENTRANT when any std lib header
-// file is included, therefore for consistency we define it here as well.
-# define _REENTRANT
-#endif
-
#ifdef __GLIBCXX__ // gcc 3.4 and greater:
# ifdef _GLIBCXX_HAVE_GTHR_DEFAULT
//
diff --git a/indexlib/boost-compat/config/stdlib/msl.h b/indexlib/boost-compat/config/stdlib/msl.h
deleted file mode 100644
index f8ad3d9a..00000000
--- a/indexlib/boost-compat/config/stdlib/msl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// (C) Copyright John Maddock 2001.
-// (C) Copyright Darin Adler 2001.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org for most recent version.
-
-// Metrowerks standard library:
-
-#ifndef __MSL_CPP__
-# include <utility>
-# ifndef __MSL_CPP__
-# error This is not the MSL standard library!
-# endif
-#endif
-
-#if __MSL_CPP__ >= 0x6000 // Pro 6
-# define BOOST_HAS_HASH
-# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
-#endif
-#define BOOST_HAS_SLIST
-
-#if __MSL_CPP__ < 0x6209
-# define BOOST_NO_STD_MESSAGES
-#endif
-
-// check C lib version for <stdint.h>
-#include <cstddef>
-
-#if defined(__MSL__) && (__MSL__ >= 0x5000)
-# define BOOST_HAS_STDINT_H
-# if !defined(__PALMOS_TRAPS__)
-# define BOOST_HAS_UNISTD_H
-# endif
- // boilerplate code:
-# include <boost/config/posix_features.hpp>
-#endif
-
-#if defined(_MWMT) || _MSL_THREADSAFE
-# define BOOST_HAS_THREADS
-#endif
-
-
-#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__)
-
-
-
-
-
-
-
-
-
diff --git a/indexlib/boost-compat/config/stdlib/roguewave.h b/indexlib/boost-compat/config/stdlib/roguewave.h
index ec3d881b..2e116ff1 100644
--- a/indexlib/boost-compat/config/stdlib/roguewave.h
+++ b/indexlib/boost-compat/config/stdlib/roguewave.h
@@ -48,13 +48,6 @@
# endif
//
-// Borland version of numeric_limits lacks __int64 specialisation:
-//
-#ifdef __BORLANDC__
-# define BOOST_NO_MS_INT64_NUMERIC_LIMITS
-#endif
-
-//
// No std::iterator if it can't figure out default template args:
//
#if defined(_RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || defined(RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES) || (BOOST_RWSTD_VER < 0x020000)
@@ -73,7 +66,6 @@
// new-style iostreams, and no conformant std::allocator:
//
#if (BOOST_RWSTD_VER < 0x020000)
-# define BOOST_NO_AUTO_PTR
# define BOOST_NO_STRINGSTREAM
# define BOOST_NO_STD_ALLOCATOR
# define BOOST_NO_STD_LOCALE
diff --git a/indexlib/boost-compat/config/stdlib/stlport.h b/indexlib/boost-compat/config/stdlib/stlport.h
index 4843ea59..8bc5c1d0 100644
--- a/indexlib/boost-compat/config/stdlib/stlport.h
+++ b/indexlib/boost-compat/config/stdlib/stlport.h
@@ -52,11 +52,11 @@
// then the io stream facets are not available in namespace std::
//
#ifdef _STLPORT_VERSION
-# if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__)
+# if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE)
# define BOOST_NO_STD_LOCALE
# endif
#else
-# if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__)
+# if !defined(__SGI_STL_OWN_IOSTREAMS) && defined(__STL_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE)
# define BOOST_NO_STD_LOCALE
# endif
#endif
@@ -106,13 +106,7 @@
// but doesn't always get them all, define BOOST_NO_STDC_NAMESPACE, since our
// workaround does not conflict with STLports:
//
-//
-// Harold Howe says:
-// Borland switched to STLport in BCB6. Defining BOOST_NO_STDC_NAMESPACE with
-// BCB6 does cause problems. If we detect C++ Builder, then don't define
-// BOOST_NO_STDC_NAMESPACE
-//
-#if !defined(__BORLANDC__) && !defined(__DMC__)
+#if !defined(__DMC__)
//
// If STLport is using it's own namespace, and the real names are in
// the global namespace, then we duplicate STLport's using declarations
@@ -127,21 +121,6 @@
# define BOOST_NO_STDC_NAMESPACE
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
# endif
-#elif defined(__BORLANDC__) && __BORLANDC__ < 0x560
-// STLport doesn't import std::abs correctly:
-#include <stdlib.h>
-namespace std { using ::abs; }
-// and strcmp/strcpy don't get imported either ('cos they are macros)
-#include <string.h>
-#ifdef strcpy
-# undef strcpy
-#endif
-#ifdef strcmp
-# undef strcmp
-#endif
-#ifdef _STLP_VENDOR_CSTD
-namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; }
-#endif
#endif
//
@@ -173,14 +152,6 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy;
#endif
//
-// Borland ships a version of STLport with C++ Builder 6 that lacks
-// hashtables and the like:
-//
-#if defined(__BORLANDC__) && (__BORLANDC__ == 0x560)
-# undef BOOST_HAS_HASH
-#endif
-
-//
// gcc-2.95.3/STLPort does not like the using declarations we use to get ADL with std::min/max
//
#if defined(__GNUC__) && (__GNUC__ < 3)
diff --git a/indexlib/boost-compat/config/suffix.h b/indexlib/boost-compat/config/suffix.h
index 313faea9..db64f87a 100644
--- a/indexlib/boost-compat/config/suffix.h
+++ b/indexlib/boost-compat/config/suffix.h
@@ -31,8 +31,8 @@
// no namespace issues from this.
//
#include <limits.h>
-# if !defined(BOOST_HAS_LONG_LONG) \
- && !(defined(BOOST_MSVC) && BOOST_MSVC <=1300) && !defined(__BORLANDC__) \
+# if !defined(BOOST_HAS_LONG_LONG) \
+ && !(defined(BOOST_MSVC) && BOOST_MSVC <=1300) \
&& (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
# define BOOST_HAS_LONG_LONG
#endif
diff --git a/indexlib/boost-compat/intrusive_ptr.h b/indexlib/boost-compat/intrusive_ptr.h
index 39b4b7b2..a2af559b 100644
--- a/indexlib/boost-compat/intrusive_ptr.h
+++ b/indexlib/boost-compat/intrusive_ptr.h
@@ -127,14 +127,6 @@ public:
return p_ != 0;
}
-#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
- typedef T * (this_type::*unspecified_bool_type)() const;
-
- operator unspecified_bool_type() const // never throws
- {
- return p_ == 0? 0: &this_type::get;
- }
-
#else
typedef T * this_type::*unspecified_bool_type;
@@ -146,7 +138,6 @@ public:
#endif
- // operator! is a Borland-specific workaround
bool operator! () const
{
return p_ == 0;
diff --git a/indexlib/boost-compat/scoped_ptr.h b/indexlib/boost-compat/scoped_ptr.h
index 60078bf1..41d4f9b8 100644
--- a/indexlib/boost-compat/scoped_ptr.h
+++ b/indexlib/boost-compat/scoped_ptr.h
@@ -15,7 +15,7 @@
#include "checked_delete.h"
-#include <memory> // for std::auto_ptr
+#include <memory>
#include <assert.h>
namespace boost
@@ -25,7 +25,7 @@ namespace boost
// scoped_ptr mimics a built-in pointer except that it guarantees deletion
// of the object pointed to, either on destruction of the scoped_ptr or via
// an explicit reset(). scoped_ptr is a simple solution for simple needs;
-// use shared_ptr or std::auto_ptr if your needs are more complex.
+// use shared_ptr or std::unique_ptr if your needs are more complex.
template<class T> class scoped_ptr // noncopyable
{
@@ -46,11 +46,6 @@ public:
{
}
-
- explicit scoped_ptr(std::auto_ptr<T> p): ptr(p.release()) // never throws
- {
- }
-
~scoped_ptr() // never throws
{
boost::checked_delete(ptr);
diff --git a/indexlib/boost-compat/shared_ptr.h b/indexlib/boost-compat/shared_ptr.h
index c236e3bd..a369dc0f 100644
--- a/indexlib/boost-compat/shared_ptr.h
+++ b/indexlib/boost-compat/shared_ptr.h
@@ -26,11 +26,11 @@
#include <boost/detail/shared_count.hpp>
#include <boost/detail/workaround.hpp>
-#include <memory> // for std::auto_ptr
-#include <algorithm> // for std::swap
-#include <functional> // for std::less
-#include <typeinfo> // for std::bad_cast
-#include <iosfwd> // for std::basic_ostream
+#include <memory>
+#include <algorithm>
+#include <functional>
+#include <typeinfo>
+#include <iosfwd>
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
# pragma warning(push)
@@ -106,7 +106,6 @@ template<class T> class shared_ptr
{
private:
- // Borland 5.5.1 specific workaround
typedef shared_ptr<T> this_type;
public:
@@ -139,8 +138,8 @@ public:
// generated copy constructor, assignment, destructor are fine...
-// except that Borland C++ has a bug, and g++ with -Wsynth warns
-#if defined(__BORLANDC__) || defined(__GNUC__)
+// except that g++ with -Wsynth warns
+#if defined(__GNUC__)
shared_ptr & operator=(shared_ptr const & r) // never throws
{
@@ -191,18 +190,6 @@ public:
}
}
-#ifndef BOOST_NO_AUTO_PTR
-
- template<class Y>
- explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn()
- {
- Y * tmp = r.get();
- pn = detail::shared_count(r);
- detail::sp_enable_shared_from_this( pn, tmp, tmp );
- }
-
-#endif
-
#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200)
template<class Y>
@@ -215,17 +202,6 @@ public:
#endif
-#ifndef BOOST_NO_AUTO_PTR
-
- template<class Y>
- shared_ptr & operator=(std::auto_ptr<Y> & r)
- {
- this_type(r).swap(*this);
- return *this;
- }
-
-#endif
-
void reset() // never throws in 1.30+
{
this_type().swap(*this);
@@ -268,14 +244,6 @@ public:
return px != 0;
}
-#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
- typedef T * (this_type::*unspecified_bool_type)() const;
-
- operator unspecified_bool_type() const // never throws
- {
- return px == 0? 0: &this_type::get;
- }
-
#else
typedef T * this_type::*unspecified_bool_type;
diff --git a/indexlib/boost-compat/weak_ptr.h b/indexlib/boost-compat/weak_ptr.h
index 338e5221..56d7ad6b 100644
--- a/indexlib/boost-compat/weak_ptr.h
+++ b/indexlib/boost-compat/weak_ptr.h
@@ -27,7 +27,6 @@ template<class T> class weak_ptr
{
private:
- // Borland 5.5.1 specific workarounds
typedef weak_ptr<T> this_type;
public:
diff --git a/indexlib/compressed.cpp b/indexlib/compressed.cpp
index a60c3f06..9c73c304 100644
--- a/indexlib/compressed.cpp
+++ b/indexlib/compressed.cpp
@@ -53,7 +53,7 @@ memory_manager* get_comp_p() {
compressed_file::compressed_file( std::string base ):
auxdata_( path_concat( base, "table" ) ),
- data_( std::auto_ptr<memory_manager>( new mmap_manager( path_concat( base, "data" ) ) ) )
+ data_( std::unique_ptr<memory_manager>( new mmap_manager( path_concat( base, "data" ) ) ) )
{
if ( auxdata_.empty() ) auxdata_.push_back( 0 );
}
diff --git a/indexlib/create.cpp b/indexlib/create.cpp
index e47d116a..c64e2158 100644
--- a/indexlib/create.cpp
+++ b/indexlib/create.cpp
@@ -56,41 +56,41 @@ indexlib::index_type::type type_of( const char* basename ) {
}
}
-std::auto_ptr<indexlib::index> indexlib::create( const char* basename, indexlib::index_type::type flags ) {
+std::unique_ptr<indexlib::index> indexlib::create( const char* basename, indexlib::index_type::type flags ) {
using namespace indexlib::version;
- if ( type_of( basename ) != indexlib::index_type::none ) return std::auto_ptr<indexlib::index>( 0 );
+ if ( type_of( basename ) != indexlib::index_type::none ) return std::unique_ptr<indexlib::index>();
try {
if ( basename[ strlen( basename ) - 1 ] == '/' && !isdir( basename ) ) {
- if ( !indexlib::detail::mkdir_trailing( basename ) ) return std::auto_ptr<indexlib::index>( 0 );
+ if ( !indexlib::detail::mkdir_trailing( basename ) ) return std::unique_ptr<indexlib::index>();
}
std::ofstream info( path_concat( basename, "info" ).c_str() );
info << marker << std::endl;
info << "version " << major << '.' << minor << "\n";
if ( flags == index_type::quotes ) {
info << "quotes" << std::endl;
- return std::auto_ptr<indexlib::index>( new quotes( basename ) );
+ return std::unique_ptr<indexlib::index>( new quotes( basename ) );
}
if ( flags == index_type::ifile ) {
info << "ifile" << std::endl;
- return std::auto_ptr<indexlib::index>( new ifile( basename ) );
+ return std::unique_ptr<indexlib::index>( new ifile( basename ) );
}
} catch ( const std::exception& e ) {
std::cerr << "index creation failed: " << e.what() << std::endl;
}
- return std::auto_ptr<indexlib::index>( 0 );
+ return std::unique_ptr<indexlib::index>();
}
-std::auto_ptr<indexlib::index> indexlib::open( const char* basename, unsigned flags ) {
+std::unique_ptr<indexlib::index> indexlib::open( const char* basename, unsigned flags ) {
using namespace indexlib;
switch ( type_of( basename ) ) {
- case index_type::ifile: return std::auto_ptr<indexlib::index>( new ifile( basename ) );
- case index_type::quotes: return std::auto_ptr<indexlib::index>( new quotes( basename ) );
+ case index_type::ifile: return std::unique_ptr<indexlib::index>( new ifile( basename ) );
+ case index_type::quotes: return std::unique_ptr<indexlib::index>( new quotes( basename ) );
case index_type::none:
- if ( flags == open_flags::fail_if_nonexistant ) return std::auto_ptr<indexlib::index>();
+ if ( flags == open_flags::fail_if_nonexistant ) return std::unique_ptr<indexlib::index>();
return create( basename, index_type::type( flags ) );
}
logfile() << format( "%s:%s: Unexpected code reached!\n" ) % __FILE__ % __LINE__;
- return std::auto_ptr<indexlib::index>( 0 );
+ return std::unique_ptr<indexlib::index>();
}
bool indexlib::exists( const char* basename ) {
diff --git a/indexlib/create.h b/indexlib/create.h
index e865728e..18e9929b 100644
--- a/indexlib/create.h
+++ b/indexlib/create.h
@@ -57,14 +57,14 @@ namespace indexlib {
* This will return something like "new quotes(basename)" but by using this, you do not need to include quotes.h
* which needs boost headers also.
*/
- std::auto_ptr<index> create( const char* basename, index_type::type flags = index_type::quotes );
+ std::unique_ptr<index> create( const char* basename, index_type::type flags = index_type::quotes );
namespace open_flags {
enum type { none = 0,
create_ifile = index_type::ifile,
create_quotes = index_type::quotes,
fail_if_nonexistant };
}
- std::auto_ptr<index> open( const char* basename, unsigned flags = open_flags::fail_if_nonexistant );
+ std::unique_ptr<index> open( const char* basename, unsigned flags = open_flags::fail_if_nonexistant );
/**
* Removes the index.
diff --git a/indexlib/ifile.cpp b/indexlib/ifile.cpp
index 5709bb41..43057433 100644
--- a/indexlib/ifile.cpp
+++ b/indexlib/ifile.cpp
@@ -83,10 +83,10 @@ void ifile::remove_doc( const char* doc ) {
// TODO: remove from words_ too if that's the case
}
-std::auto_ptr<indexlib::result> ifile::everything() const {
+std::unique_ptr<indexlib::result> ifile::everything() const {
std::vector<unsigned> res( ndocs() );
for ( unsigned i = 0; i != ndocs(); ++i ) res[ i ] = i;
- return std::auto_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
+ return std::unique_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
}
namespace {
@@ -94,13 +94,13 @@ inline
bool word_too_small( std::string str ) { return str.size() < 3; }
}
-std::auto_ptr<indexlib::result> ifile::search( const char* str ) const {
+std::unique_ptr<indexlib::result> ifile::search( const char* str ) const {
using namespace indexlib::detail;
using indexlib::result;
assert( str );
if ( !*str ) return everything();
std::vector<std::string> words = break_clean( str );
- if ( words.empty() ) return std::auto_ptr<result>( new empty_result );
+ if ( words.empty() ) return std::unique_ptr<result>( new empty_result );
words.erase( std::remove_if( words.begin(), words.end(), &word_too_small ), words.end() );
if ( words.empty() ) return everything();
std::set<unsigned> values = find_word( words[ 0 ] );
@@ -113,7 +113,7 @@ std::auto_ptr<indexlib::result> ifile::search( const char* str ) const {
std::set_intersection( now.begin(), now.end(), values.begin(), values.end(), std::inserter( next, next.begin() ) );
next.swap( values );
}
- std::auto_ptr<result> r(new simple_result( std::vector<unsigned>( values.begin(), values.end() ) ) );
+ std::unique_ptr<result> r(new simple_result( std::vector<unsigned>( values.begin(), values.end() ) ) );
return r;
}
@@ -169,7 +169,7 @@ std::vector<std::string> ifile::break_clean( const char* complete ) const {
std::sort( words.begin(), words.end() );
words.erase( std::unique( words.begin(), words.end() ), words.end() );
words.erase( std::remove_if( words.begin(), words.end(), &ifile::invalid_word ), words.end() );
- words.erase( std::remove_if( words.begin(), words.end(), std::bind1st( std::mem_fun( &ifile::is_stop_word ), this ) ), words.end() );
+ words.erase( std::remove_if( words.begin(), words.end(), std::bind( std::mem_fn( &ifile::is_stop_word ), this, std::placeholders::_1 ) ), words.end() );
return words;
}
diff --git a/indexlib/ifile.h b/indexlib/ifile.h
index 4cfcf585..3fcf772e 100644
--- a/indexlib/ifile.h
+++ b/indexlib/ifile.h
@@ -43,8 +43,10 @@
struct ifile : public indexlib::index {
public:
ifile( std::string );
+ ifile(ifile const &) = delete;
+ ifile& operator=(ifile const &) = delete;
virtual void add( const char* str, const char* doc );
- virtual std::auto_ptr<indexlib::result> search( const char* ) const;
+ virtual std::unique_ptr<indexlib::result> search( const char* ) const;
virtual unsigned ndocs() const { return docnames_.size(); }
virtual std::string lookup_docname( unsigned idx ) const { return docnames_.get( idx ); }
@@ -56,7 +58,7 @@ struct ifile : public indexlib::index {
private:
std::set<unsigned> find_word( std::string ) const;
std::vector<std::string> break_clean( const char* ) const;
- virtual std::auto_ptr<indexlib::result> everything() const;
+ virtual std::unique_ptr<indexlib::result> everything() const;
static bool invalid_word( std::string );
bool is_stop_word( std::string ) const;
@@ -67,7 +69,7 @@ struct ifile : public indexlib::index {
stringset words_;
stringset stopwords_;
leafdatavector files_;
- std::auto_ptr<indexlib::detail::tokenizer> tokenizer_;
+ std::unique_ptr<indexlib::detail::tokenizer> tokenizer_;
};
#endif /* _IFILE_INCLUDE_GUARD_LPC_56465465798732 */
diff --git a/indexlib/index.h b/indexlib/index.h
index b7c68375..5ffab2d4 100644
--- a/indexlib/index.h
+++ b/indexlib/index.h
@@ -61,7 +61,7 @@ struct result {
* @return null if the type does not support this or the particular search string makes it impossible to
* fulfill the search request.
*/
- virtual std::auto_ptr<result> search( const char* ) = 0;
+ virtual std::unique_ptr<result> search( const char* ) = 0;
};
struct index {
@@ -96,7 +96,7 @@ struct index {
/**
* Returns all documents matching \param pattern.
*/
- virtual std::auto_ptr<result> search( const char* pattern ) const = 0;
+ virtual std::unique_ptr<result> search( const char* pattern ) const = 0;
/**
* Returns the number of docs indexed.
diff --git a/indexlib/leafdatavector.cpp b/indexlib/leafdatavector.cpp
index 0dae6555..89b95ab9 100644
--- a/indexlib/leafdatavector.cpp
+++ b/indexlib/leafdatavector.cpp
@@ -45,7 +45,7 @@ typedef mmap_manager leafdatavector_manager;
#endif
leafdatavector::leafdatavector( std::string name ):
- leafs_( std::auto_ptr<memory_manager>( new leafdatavector_manager( path_concat( name, "leafs" ) ) ) ),
+ leafs_( std::unique_ptr<memory_manager>( new leafdatavector_manager( path_concat( name, "leafs" ) ) ) ),
table_( path_concat( name, "table" ) )
{
}
diff --git a/indexlib/main.cpp b/indexlib/main.cpp
index b8685153..dcedbe1c 100644
--- a/indexlib/main.cpp
+++ b/indexlib/main.cpp
@@ -46,7 +46,7 @@
#include <memory>
#include <string.h>
-typedef std::auto_ptr<indexlib::index> index_smart;
+typedef std::unique_ptr<indexlib::index> index_smart;
index_smart get_index( std::string name ) {
return indexlib::open( name.c_str(), indexlib::open_flags::create_quotes );
@@ -92,8 +92,8 @@ int debug( int argc, char* argv[] ) {
std::cout << "compressed_file:\n";
file.print( std::cout );
} else if ( type == "break_up" ) {
- std::auto_ptr<tokenizer> tok = get_tokenizer( "latin-1:european" );
- if ( !tok.get() ) {
+ std::unique_ptr<tokenizer> tok = get_tokenizer( "latin-1:european" );
+ if ( !tok ) {
std::cerr << "Could not get tokenizer\n";
return 1;
}
diff --git a/indexlib/mempool.h b/indexlib/mempool.h
index acf62494..08be8857 100644
--- a/indexlib/mempool.h
+++ b/indexlib/mempool.h
@@ -55,7 +55,9 @@ struct mempool /* : boost::noncopyable */ {
typedef Traits traits_type;
typedef typename traits_type::value_type data_type;
typedef typename traits_type::pointer data_typeptr;
- explicit mempool( std::auto_ptr<memory_manager> source );
+ explicit mempool( std::unique_ptr<memory_manager> &&source );
+ mempool(mempool const &) = delete;
+ mempool& operator=(mempool const &) = delete;
/**
* Returns a memory block of size \param s.
@@ -151,7 +153,7 @@ struct mempool /* : boost::noncopyable */ {
bool join( data_typeptr&, unsigned order );
void deallocate( data_typeptr, unsigned order );
- std::auto_ptr<memory_manager> manager_;
+ std::unique_ptr<memory_manager> manager_;
memory_reference<uint32_t> max_order_;
};
diff --git a/indexlib/mempool.tcc b/indexlib/mempool.tcc
index a130bffe..750209a2 100644
--- a/indexlib/mempool.tcc
+++ b/indexlib/mempool.tcc
@@ -33,8 +33,8 @@
*/
template <typename Traits>
-mempool<Traits>::mempool( std::auto_ptr<memory_manager> source ):
- manager_( source ),
+mempool<Traits>::mempool( std::unique_ptr<memory_manager> &&source ):
+ manager_( std::move(source) ),
max_order_( 0 )
{
if ( !manager_->size() ) init_memory();
diff --git a/indexlib/quotes.cpp b/indexlib/quotes.cpp
index e4c35db4..abf8915c 100644
--- a/indexlib/quotes.cpp
+++ b/indexlib/quotes.cpp
@@ -68,12 +68,12 @@ void quotes::remove_doc( const char* doc ) {
impl_.remove_doc( doc );
}
-std::auto_ptr<indexlib::result> quotes::search( const char* cstr ) const {
+std::unique_ptr<indexlib::result> quotes::search( const char* cstr ) const {
std::string str = cstr;
if ( str[ 0 ] != '\"' ) return impl_.search( cstr );
str = cstr + 1; // cut "
if ( str.size() && str[ str.size() - 1 ] == '\"' ) str.erase( str.size() - 1 );
- std::auto_ptr<indexlib::result> prev = impl_.search( str.c_str() );
+ std::unique_ptr<indexlib::result> prev = impl_.search( str.c_str() );
if ( str.find( ' ' ) != std::string::npos ) {
indexlib::Match m( str );
std::vector<unsigned> candidates = prev->list();
@@ -86,7 +86,7 @@ std::auto_ptr<indexlib::result> quotes::search( const char* cstr ) const {
res.push_back( *first );
}
}
- return std::auto_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
+ return std::unique_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
} else { return prev; }
}
diff --git a/indexlib/quotes.h b/indexlib/quotes.h
index 7852d0dd..6604e9a9 100644
--- a/indexlib/quotes.h
+++ b/indexlib/quotes.h
@@ -42,7 +42,7 @@ struct quotes : public indexlib::index {
quotes( std::string );
virtual void add( const char* str, const char* doc );
virtual void remove_doc( const char* doc );
- virtual std::auto_ptr<indexlib::result> search( const char* ) const;
+ virtual std::unique_ptr<indexlib::result> search( const char* ) const;
virtual unsigned ndocs() const { return impl_.ndocs(); }
virtual std::string lookup_docname( unsigned d ) const { return impl_.lookup_docname( d ); }
diff --git a/indexlib/result.h b/indexlib/result.h
index 4cad40d7..dd23f25d 100644
--- a/indexlib/result.h
+++ b/indexlib/result.h
@@ -42,7 +42,7 @@ struct simple_result : indexlib::result {
simple_result( std::vector<unsigned> r ):res( r ) { }
std::vector<unsigned> list() const { return res; }
- std::auto_ptr<result> search( const char* ) { return std::auto_ptr<result>( 0 ); }
+ std::unique_ptr<result> search( const char* ) { return std::unique_ptr<result>(); }
private:
std::vector<unsigned> res;
};
@@ -50,7 +50,7 @@ struct simple_result : indexlib::result {
struct empty_result : indexlib::result {
public:
std::vector<unsigned> list() const { return std::vector<unsigned>(); }
- std::auto_ptr<result> search( const char* ) { return std::auto_ptr<result>(); }
+ std::unique_ptr<result> search( const char* ) { return std::unique_ptr<result>(); }
};
} //namespace detail
} //namespace indexlib
diff --git a/indexlib/tests/create-test.cpp b/indexlib/tests/create-test.cpp
index beeb7d5f..da3c91ca 100644
--- a/indexlib/tests/create-test.cpp
+++ b/indexlib/tests/create-test.cpp
@@ -14,8 +14,8 @@ void cleanup() {
void simple() {
cleanup();
- std::auto_ptr<indexlib::index> ptr = indexlib::create( fname );
- BOOST_CHECK( ptr.get() );
+ std::unique_ptr<indexlib::index> ptr = indexlib::create( fname );
+ BOOST_CHECK( ptr );
}
test_suite* get_suite() {
diff --git a/indexlib/tests/mempool-test.cpp b/indexlib/tests/mempool-test.cpp
index a0895243..1c9a4eb6 100644
--- a/indexlib/tests/mempool-test.cpp
+++ b/indexlib/tests/mempool-test.cpp
@@ -11,7 +11,7 @@ void cleanup() {
void deallocate() {
cleanup();
- mempool<leaf_data_pool_traits> pool( std::auto_ptr<memory_manager>( new mmap_manager( fname ) ) );
+ mempool<leaf_data_pool_traits> pool( std::unique_ptr<memory_manager>( new mmap_manager( fname ) ) );
std::vector<leafdataptr> pointers;
for ( int i = 0; i != 32; ++i ) {
@@ -33,7 +33,7 @@ void deallocate() {
void large() {
cleanup();
- mempool<leaf_data_pool_traits> pool( std::auto_ptr<memory_manager>( new mmap_manager( fname ) ) );
+ mempool<leaf_data_pool_traits> pool( std::unique_ptr<memory_manager>( new mmap_manager( fname ) ) );
pool.allocate( 4095 );
pool.allocate( 4097 );
diff --git a/indexlib/tests/tokenizer-test.cpp b/indexlib/tests/tokenizer-test.cpp
index 372859d9..1354ddcd 100644
--- a/indexlib/tests/tokenizer-test.cpp
+++ b/indexlib/tests/tokenizer-test.cpp
@@ -9,8 +9,8 @@ using indexlib::detail::tokenizer;
using indexlib::detail::get_tokenizer;
void simple() {
- std::auto_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
- assert(tokenizer.get());
+ std::unique_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
+ assert(tokenizer);
std::vector<std::string> tokens = tokenizer->string_to_words( "one ,as, ''#`:ThReE, בבאחי" );
std::vector<std::string> expected;
expected.push_back( "ONE" );
@@ -26,8 +26,8 @@ void simple() {
}
void with_newlines() {
- std::auto_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
- assert(tokenizer.get());
+ std::unique_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
+ assert(tokenizer);
std::vector<std::string> tokens = tokenizer->string_to_words( "one\ntwo\nthree" );
std::vector<std::string> expected;
expected.push_back( "ONE" );
@@ -42,8 +42,8 @@ void with_newlines() {
}
void with_numbers() {
- std::auto_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
- assert(tokenizer.get());
+ std::unique_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
+ assert(tokenizer);
std::vector<std::string> tokens = tokenizer->string_to_words( "one 012 123 four" );
std::vector<std::string> expected;
expected.push_back( "ONE" );
diff --git a/indexlib/tokenizer.cpp b/indexlib/tokenizer.cpp
index b069c748..1c1243a7 100644
--- a/indexlib/tokenizer.cpp
+++ b/indexlib/tokenizer.cpp
@@ -294,7 +294,7 @@ class latin1_tokenizer : public indexlib::detail::tokenizer {
}
-std::auto_ptr<indexlib::detail::tokenizer> indexlib::detail::get_tokenizer( std::string name ) {
- if ( name == "latin-1:european" ) return std::auto_ptr<indexlib::detail::tokenizer>( new latin1_tokenizer );
- return std::auto_ptr<indexlib::detail::tokenizer>( 0 );
+std::unique_ptr<indexlib::detail::tokenizer> indexlib::detail::get_tokenizer( std::string name ) {
+ if ( name == "latin-1:european" ) return std::unique_ptr<indexlib::detail::tokenizer>( new latin1_tokenizer );
+ return std::unique_ptr<indexlib::detail::tokenizer>();
}
diff --git a/indexlib/tokenizer.h b/indexlib/tokenizer.h
index 2494f297..9916df66 100644
--- a/indexlib/tokenizer.h
+++ b/indexlib/tokenizer.h
@@ -20,7 +20,7 @@ class tokenizer {
virtual std::vector<std::string> do_string_to_words( const char* ) = 0;
};
-std::auto_ptr<tokenizer> get_tokenizer( std::string );
+std::unique_ptr<tokenizer> get_tokenizer( std::string );
}}