Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Imported upstream 1.9.100

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
  • Loading branch information...
commit 88b103ccc74ec3d4d0a9e588773f369f21c9b9ea 1 parent 6059296
Stefan Naewe authored
Showing with 1,241 additions and 347 deletions.
  1. +144 −5 CHANGES.txt
  2. +21 −5 HISTORY.txt
  3. +6 −6 INSTALL.txt
  4. +3 −1 NEWS.txt
  5. +12 −2 include/comstl/util/rot_functions.h
  6. +50 −13 include/platformstl/filesystem/file_lines.hpp
  7. +157 −77 include/stlsoft/algorithms/pod.hpp
  8. +54 −2 include/stlsoft/algorithms/std/alt.hpp
  9. +7 −6 include/stlsoft/error/error_desc.hpp
  10. +2 −2 include/stlsoft/iterators/associative_select_iterator.hpp
  11. +100 −0 include/stlsoft/iterators/common/string_concatenation_flags.hpp
  12. +93 −24 include/stlsoft/iterators/string_concatenator_iterator.hpp
  13. +47 −30 include/stlsoft/performance/performance_counter_init.hpp
  14. +60 −11 include/stlsoft/stlsoft.h
  15. +23 −20 include/stlsoft/string/special_string_instance.hpp
  16. +5 −5 include/stlsoft/string/string_tokeniser.hpp
  17. +15 −13 include/stlsoft/string/string_view.hpp
  18. +14 −4 include/stlsoft/util/constraints.hpp
  19. +87 −4 include/stlsoft/util/minmax.hpp
  20. +4 −4 include/stlsoft/util/std_swap.hpp
  21. +29 −11 include/unixstl/dl/module.hpp
  22. +22 −7 include/unixstl/filesystem/filesystem_traits.hpp
  23. +9 −4 include/unixstl/filesystem/path.hpp
  24. +10 −10 include/winstl/conversion/char_conversions.hpp
  25. +12 −8 include/winstl/dl/module.hpp
  26. +6 −5 include/winstl/filesystem/absolute_path.hpp
  27. +5 −4 include/winstl/filesystem/current_directory.hpp
  28. +13 −3 include/winstl/filesystem/filesystem_traits.hpp
  29. +13 −8 include/winstl/filesystem/path.hpp
  30. +37 −10 include/winstl/system/console_functions.h
  31. +17 −4 include/winstl/system/environment_variable.hpp
  32. +6 −5 include/winstl/system/module_directory.hpp
  33. +6 −5 include/winstl/system/module_filename.hpp
  34. +7 −7 include/winstl/system/searchpath_sequence.hpp
  35. +6 −5 include/winstl/system/system_directory.hpp
  36. +114 −3 include/winstl/system/system_traits.hpp
  37. +6 −5 include/winstl/system/windows_directory.hpp
  38. +19 −9 include/winstl/winstl.h
View
149 CHANGES.txt
@@ -2,7 +2,7 @@
STLSoft - Changes
; Created: 29th March 2002
-; Updated: 21st June 2010
+; Updated: 12th August 2010
============================================================================
@@ -19,19 +19,158 @@ STLSoft - Changes
============================================================================
+Changes for 1.9.100 (12th August 2010)
+
+Summary:
+========
+
+ * added stlsoft/iterators/common/string_concatenation_flags.hpp
+ * string_concatenator_iterator now strictly skips separator insertion for empty elements if no flags are specified, and always inserts separator if string_concatenation_flags::AlwaysSeparate is specified
+ * added performance_counter_init::get_period_and_restart() method
+ * added STLSOFT_CC_CDECL_VALUE, STLSOFT_CC_FASTCALL_VALUE, STLSOFT_CC_STDCALL_VALUE
+ * special_string_instance now uses atomic_int_type
+ * string_tokeniser iterator dereference operator changed to disallow return of mutable instance
+ * string_view has improved comparison algorithm
+ * added 3-, 4-, and 5-parameter overloads of stlsoft::minimum() and stlsoft::maximum()
+ * various fixes and enhancements to platformstl::file_lines
+ * added size() and empty() methods to winstl::environment_variable
+ * implemented winstl::system_traits::str_n_compare_no_case()
+
+Changes:
+========
+
+ STLSoft:
+ ========
+
+ ~ stlsoft/algorithms/pod.hpp:
+ ~ refactored, to remove inappropriate constraints
+
+ + stlsoft/iterators/common/string_concatenation_flags.hpp:
+ + added stlsoft/iterators/common/string_concatenation_flags.hpp
+
+ ~ stlsoft/iterators/string_concatenator_iterator.hpp:
+ ~ now strictly skips separator insertion for empty elements if no flags are specified, and always inserts separator if string_concatenation_flags::AlwaysSeparate is specified
+
+ ~ stlsoft/performance/performance_counter_init.hpp:
+ + added get_period_and_restart() method
+
+ ~ stlsoft/stlsoft.h:
+ + added STLSOFT_CC_CDECL_VALUE
+ + added STLSOFT_CC_FASTCALL_VALUE
+ + added STLSOFT_CC_STDCALL_VALUE
+
+ ~ stlsoft/string/special_string_instance.hpp:
+ ~ special_string_instance now uses atomic_int_type
+ ~ minor change to avoid possible undefined-behaviour
+
+ ~ stlsoft/string/string_tokeniser.hpp:
+ ~ iterator dereference operator changed to disallow return of mutable instance
+
+ ~ stlsoft/string/string_view.hpp:
+ ~ improved comparison algorithm
+ ~ performance improvement in equal(class_type const&) method
+
+ ~ stlsoft/util/constraints.hpp:
+ ~ compiler compatibility
+ ~ compatibility
+ ~ workaround for pedantic warnings
+
+ ~ stlsoft/util/minmax.hpp:
+ + 3-, 4-, and 5-parameter overloads
+
+ COMSTL:
+ =======
+
+ ~ comstl/util/rot_functions.h:
+ ~ trivial commenting changes
+
+ PlatformSTL:
+ ============
+
+ ~ platformstl/filesystem/file_lines.hpp:
+ ~ 64-bit compatibility
+ ~ corrects the determination of whether to discard the mapping to work on the first non-empty string, since it will fault if the first line in a mapped file is empty but any others are not
+ + conversion constructor is now explicit
+ + added private declaration of constructor template to prevents the conversion constructor from being invoked on an instance of a different specialisation
+ ~ allows wider range of string types to be used, in particular those that are copy-constructible but do not provide assign() methods
+
+ UNIXSTL:
+ ========
+
+ ~ unixstl/dl/module.hpp:
+ ~ includes STLSoft's main shims header, to at least allow GCC to see std::string arguments without hassle
+ + added typedefs to make compatible with get_module_handle() shim (not yet complete for UNIXSTL)
+ ~ surrounding template methods with #ifdefs
+ ~ throw() for unload() method(s)
+
+ ~ unixstl/filesystem/filesystem_traits.hpp:
+ ~ GCC (on Windows) compatibility
+ + added missing member constant pathComparisonIsCaseSensitive to specialisations
+
+ ~ unixstl/filesystem/path.hpp:
+ ~ ensures push_ext() is wide-string compatible
+
+ WinSTL:
+ =======
+
+ ~ winstl/dl/module.hpp:
+ ~ documentation markup
+
+ ~ winstl/filesystem/absolute_path.hpp:
+ ~ winstl/filesystem/current_directory.hpp:
+ ~ winstl/system/module_directory.hpp:
+ ~ winstl/system/module_filename.hpp:
+ ~ special_string_instance now uses atomic_int_type
+
+ ~ winstl/filesystem/filesystem_traits.hpp:
+ + added missing member constant pathComparisonIsCaseSensitive to specialisations
+
+ ~ winstl/filesystem/path.hpp:
+ ~ ensures push_ext() is wide-string compatible
+
+ ~ winstl/system/console_functions.h:
+ ~ winstl__get_console_width() => winstl_C_get_console_width()
+ ~ winstl__get_console_window() => winstl_C_get_console_window()
+ ~ minor improvements to use of casts
+
+ ~ winstl/system/environment_variable.hpp:
+ + added size() method
+ + added empty() method
+
+ ~ winstl/system/searchpath_sequence.hpp:
+ ~ 64-bit compatibility
+
+ ~ winstl/system/system_directory.hpp:
+ + added atomic_int_type
+
+ ~ winstl/system/system_traits.hpp:
+ ~ implementation(s) of str_n_compare_no_case()
+
+ ~ winstl/system/windows_directory.hpp:
+ + added atomic_int_type
+
+ ~ winstl/winstl.h:
+ + added ws_intptr_t
+ + added ws_sintptr_t
+ + added ws_uintptr_t
+
+
+
+============================================================================
+
Changes for 1.9.99 (21st June 2010)
Summary:
========
- * added filesystem_traits::str_fs_compare() (UNIXSTL & WinSTL)
- * added filesystem_traits::str_fs_n_compare() (UNIXSTL & WinSTL)
- * added str_n_compare_no_case declaration to system_traits (UNIXSTL & WinSTL)
+ * added filesystem_traits::str_fs_compare() (UNIXSTL & WinSTL)
+ * added filesystem_traits::str_fs_n_compare() (UNIXSTL & WinSTL)
+ * added str_n_compare_no_case declaration to system_traits (UNIXSTL & WinSTL)
* added assoc_select_first() and assoc_select_second() creator functions for associative_select_iterator
* incorporated Manfred Ehrhart's fixes for associative_select_iterator
* Borland/GCC-compatibility fixes
* GCC-compatibility fixes
- * nullptr support correction for VC++
+ * nullptr support correction for VC++
* various minor fixes
Changes:
View
26 HISTORY.txt
@@ -2,22 +2,38 @@
STLSoft - History
; Created: 29th March 2002
-; Updated: 21st June 2010
+; Updated: 12th August 2010
============================================================================
+12th August 2010 - 1.9.100 released
+-----------------------------------
+
+ * added stlsoft/iterators/common/string_concatenation_flags.hpp
+ * string_concatenator_iterator now strictly skips separator insertion for empty elements if no flags are specified, and always inserts separator if string_concatenation_flags::AlwaysSeparate is specified
+ * added performance_counter_init::get_period_and_restart() method
+ * added STLSOFT_CC_CDECL_VALUE, STLSOFT_CC_FASTCALL_VALUE, STLSOFT_CC_STDCALL_VALUE
+ * special_string_instance now uses atomic_int_type
+ * string_tokeniser iterator dereference operator changed to disallow return of mutable instance
+ * string_view has improved comparison algorithm
+ * added 3-, 4-, and 5-parameter overloads of stlsoft::minimum() and stlsoft::maximum()
+ * various fixes and enhancements to platformstl::file_lines
+ * added size() and empty() methods to winstl::environment_variable
+ * implemented winstl::system_traits::str_n_compare_no_case()
+
+
21st June 2010 - 1.9.99 released
--------------------------------
- * added filesystem_traits::str_fs_compare() (UNIXSTL & WinSTL)
- * added filesystem_traits::str_fs_n_compare() (UNIXSTL & WinSTL)
- * added str_n_compare_no_case declaration to system_traits (UNIXSTL & WinSTL)
+ * added filesystem_traits::str_fs_compare() (UNIXSTL & WinSTL)
+ * added filesystem_traits::str_fs_n_compare() (UNIXSTL & WinSTL)
+ * added str_n_compare_no_case declaration to system_traits (UNIXSTL & WinSTL)
* added assoc_select_first() and assoc_select_second() creator functions for associative_select_iterator
* incorporated Manfred Ehrhart's fixes for associative_select_iterator
* Borland/GCC-compatibility fixes
* GCC-compatibility fixes
- * nullptr support correction for VC++
+ * nullptr support correction for VC++
* various minor fixes
View
12 INSTALL.txt
@@ -2,7 +2,7 @@
STLSoft - Install
; Created: 29th March 2002
-; Updated: 21st June 2010
+; Updated: 12th August 2010
============================================================================
@@ -11,16 +11,16 @@ STLSoft - Install
It is recommended that you define an STLSOFT environment variable.
For example, if you're using UNIX and you install
- to /usr/local/stlsoft/stlsoft-1.9.99 then you should set the environment
- variable STLSOFT to /usr/local/stlsoft/stlsoft-1.9.99 in which case the
+ to /usr/local/stlsoft/stlsoft-1.9.100 then you should set the environment
+ variable STLSOFT to /usr/local/stlsoft/stlsoft-1.9.100 in which case the
file stlsoft/stlsoft.h will be located in
$STLSOFT/include/stlsoft/stlsoft.h
Conversely, if you're using Windows and you intall
- to C:\3pty\STLSoft\stlsoft-1.9.99 then you should set the environment
- variable STLSoft to C:\3pty\STLSoft\stlsoft-1.9.99 in which case the
+ to C:\3pty\STLSoft\stlsoft-1.9.100 then you should set the environment
+ variable STLSoft to C:\3pty\STLSoft\stlsoft-1.9.100 in which case the
file stlsoft/stlsoft.h will be located in
- C:\3pty\STLSoft\stlsoft-1.9.99\stlsoft\stlsoft.h
+ C:\3pty\STLSoft\stlsoft-1.9.100\stlsoft\stlsoft.h
The makefiles / project files of several other open-source projects expect
this symbol, including:
View
4 NEWS.txt
@@ -2,13 +2,15 @@
STLSoft - News
; Created: 29th March 2002
-; Updated: 21st June 2010
+; Updated: 12th August 2010
============================================================================
News:
+ 12th August 2010 - Release of STLSoft 1.9.100
+
21st June 2010 - Release of STLSoft 1.9.99
7th June 2010 - Release of STLSoft 1.9.98
View
14 include/comstl/util/rot_functions.h
@@ -4,7 +4,7 @@
* Purpose: COM ROT (Running Object Table) functions.
*
* Created: 21st October 1998
- * Updated: 12th January 2010
+ * Updated: 29th July 2010
*
* Home: http://stlsoft.org/
*
@@ -51,7 +51,7 @@
# define COMSTL_VER_COMSTL_UTIL_H_ROT_FUNCTIONS_MAJOR 5
# define COMSTL_VER_COMSTL_UTIL_H_ROT_FUNCTIONS_MINOR 1
# define COMSTL_VER_COMSTL_UTIL_H_ROT_FUNCTIONS_REVISION 3
-# define COMSTL_VER_COMSTL_UTIL_H_ROT_FUNCTIONS_EDIT 64
+# define COMSTL_VER_COMSTL_UTIL_H_ROT_FUNCTIONS_EDIT 65
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -288,6 +288,16 @@ STLSOFT_INLINE HRESULT comstl_C_Rot_EnumRunning(IEnumMoniker** ppenumMoniker)
return hr;
}
+/* /////////////////////////////////////////////////////////////////////////
+ * Obsolete symbols
+ *
+ * NOTE: these are only defined if:
+ *
+ * - we're generating documentation, or
+ * - STLSOFT_OBSOLETE is specified, or
+ * - it's STLSoft 1.9 (or earlier)
+ */
+
#if defined(STLSOFT_DOCUMENTATION_SKIP_SECTION) || \
defined(STLSOFT_OBSOLETE) || \
_STLSOFT_VER < 0x010a0000
View
63 include/platformstl/filesystem/file_lines.hpp
@@ -4,7 +4,7 @@
* Purpose: Platform header for the file_lines components.
*
* Created: 25th October 2007
- * Updated: 16th May 2010
+ * Updated: 12th August 2010
*
* Home: http://stlsoft.org/
*
@@ -46,8 +46,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_FILE_LINES_MAJOR 1
# define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_FILE_LINES_MINOR 4
-# define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_FILE_LINES_REVISION 1
-# define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_FILE_LINES_EDIT 18
+# define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_FILE_LINES_REVISION 6
+# define PLATFORMSTL_VER_PLATFORMSTL_FILESYSTEM_HPP_FILE_LINES_EDIT 23
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/** \file platformstl/filesystem/memory_mapped_file.hpp
@@ -125,9 +125,9 @@ namespace platformstl_project
/** Maps a text file's contents and presents them as a vector of lines
*/
-template< typename C
- , typename V = stlsoft::basic_string_view<C>
- , typename B = stlsoft::basic_simple_string<C>
+template< ss_typename_param_k C
+ , ss_typename_param_k V = stlsoft::basic_string_view<C>
+ , ss_typename_param_k B = stlsoft::basic_simple_string<C>
>
class basic_file_lines
{
@@ -150,8 +150,8 @@ class basic_file_lines
/// \name Construction
/// @{
public:
- template <typename S>
- basic_file_lines(S const& path)
+ template <ss_typename_param_k S>
+ ss_explicit_k basic_file_lines(S const& path)
: m_mmf(NULL) /* NOTE: can't initialise m_mmf here, as Borland causes the MMF ctor to fail with Access Denied. Go figure! */
, m_contents()
, m_strings()
@@ -201,9 +201,9 @@ class basic_file_lines
#endif /* OS */
#ifdef STLSOFT_CF_EXCEPTION_SUPPORT
- m_contents.assign(static_cast<C const*>(mmf.memory()), stlsoft_ns_qual(truncation_cast)<size_type>(mmf.size()));
+ m_contents = base_string_type_(static_cast<C const*>(mmf.memory()), stlsoft_ns_qual(truncation_cast)<size_type>(mmf.size()));
#else /* ? STLSOFT_CF_EXCEPTION_SUPPORT */
- m_contents.assign(static_cast<C const*>(mmf.memory()), static_cast<size_type>(mmf.size()));
+ m_contents = base_string_type_(static_cast<C const*>(mmf.memory()), static_cast<size_type>(mmf.size()));
#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
tokeniser_t_ lines(m_contents.data(), m_contents.size(), sep);
@@ -214,9 +214,37 @@ class basic_file_lines
// is ok if:
// - there are no lines, or
// - the string type copies. This is determined by checking whether
- // the first string's contents point to the base of the mapping.
- if( m_strings.empty() ||
- m_strings.front().data() != static_cast<C const*>(mmf.memory()))
+ // the first non-empty string's contents point within the mapping.
+ bool canDeleteMapping = false;
+
+ if(!canDeleteMapping)
+ {
+ canDeleteMapping = m_strings.empty();
+ }
+
+ if(!canDeleteMapping)
+ {
+ { for(ss_typename_type_k strings_type_::const_iterator i = m_strings.begin(); i != m_strings.end(); ++i)
+ {
+ if(0u != (*i).size())
+ {
+ void const* base = mmf.memory();
+#ifdef STLSOFT_CF_EXCEPTION_SUPPORT
+ void const* end = ptr_byte_offset(base, stlsoft_ns_qual(truncation_cast)<ss_ptrdiff_t>(mmf.size()));
+#else /* ? STLSOFT_CF_EXCEPTION_SUPPORT */
+ void const* end = ptr_byte_offset(base, static_cast<ss_ptrdiff_t>(mmf.size()));
+#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
+
+ void const* p = (*i).data();
+
+ canDeleteMapping = p < base || p >= end;
+
+ break;
+ }
+ }}
+ }
+
+ if(canDeleteMapping)
{
delete m_mmf;
m_mmf = NULL;
@@ -307,6 +335,15 @@ class basic_file_lines
private:
basic_file_lines(class_type const& );
class_type& operator =(class_type const& );
+
+ // Prevents the conversion constructor from being invoked on an instance
+ // of a different specialisation
+ template<
+ ss_typename_param_k C2
+ , ss_typename_param_k V2
+ , ss_typename_param_k B2
+ >
+ basic_file_lines(basic_file_lines<C2, V2, B2> const& );
/// @}
};
View
234 include/stlsoft/algorithms/pod.hpp
@@ -4,11 +4,11 @@
* Purpose: Algorithms for Plain-Old Data types.
*
* Created: 17th January 2002
- * Updated: 10th August 2009
+ * Updated: 11th August 2010
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 2002-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,8 +50,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_ALGORITHMS_HPP_POD_MAJOR 3
# define STLSOFT_VER_STLSOFT_ALGORITHMS_HPP_POD_MINOR 5
-# define STLSOFT_VER_STLSOFT_ALGORITHMS_HPP_POD_REVISION 1
-# define STLSOFT_VER_STLSOFT_ALGORITHMS_HPP_POD_EDIT 88
+# define STLSOFT_VER_STLSOFT_ALGORITHMS_HPP_POD_REVISION 3
+# define STLSOFT_VER_STLSOFT_ALGORITHMS_HPP_POD_EDIT 90
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -64,14 +64,21 @@
#ifndef STLSOFT_INCL_STLSOFT_ALGORITHM_STD_HPP_ALT
# include <stlsoft/algorithms/std/alt.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_ALGORITHM_STD_HPP_ALT */
-#if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
-# ifndef STLSOFT_INCL_STLSOFT_META_HPP_BASE_TYPE_TRAITS
-# include <stlsoft/meta/base_type_traits.hpp>
-# endif /* !STLSOFT_INCL_STLSOFT_META_HPP_BASE_TYPE_TRAITS */
-# ifndef STLSOFT_INCL_STLSOFT_UTIL_HPP_CONSTRAINTS
-# include <stlsoft/util/constraints.hpp>
-# endif /* !STLSOFT_INCL_STLSOFT_UTIL_HPP_CONSTRAINTS */
-#endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
+#ifndef STLSOFT_INCL_STLSOFT_UTIL_HPP_CONSTRAINTS
+# include <stlsoft/util/constraints.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_UTIL_HPP_CONSTRAINTS */
+#ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_INTEGRAL_TYPE
+# include <stlsoft/meta/is_integral_type.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_IS_INTEGRAL_TYPE */
+#ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_POINTER_TYPE
+# include <stlsoft/meta/is_pointer_type.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_IS_POINTER_TYPE */
+#ifndef STLSOFT_INCL_STLSOFT_META_HPP_IS_SAME_TYPE
+# include <stlsoft/meta/is_same_type.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_IS_SAME_TYPE */
+#ifndef STLSOFT_INCL_STLSOFT_META_HPP_YESNO
+# include <stlsoft/meta/yesno.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_YESNO */
#if defined(STLSOFT_COMPILER_IS_BORLAND) || \
defined(STLSOFT_COMPILER_IS_INTEL) || \
@@ -97,6 +104,97 @@ namespace stlsoft
#endif /* _STLSOFT_NO_NAMESPACE */
/* /////////////////////////////////////////////////////////////////////////
+ * Helper functions
+ */
+
+#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
+struct ximpl_stlsoft_algorithm_pod_helper_
+{
+
+ // Same-type operations
+
+ template<
+ ss_typename_param_k T
+ >
+ static void pod_copy_n_(
+ T* dest
+ , T const* src
+ , ss_size_t n
+ , yes_type
+ )
+ {
+ ::memcpy(dest, src, n * sizeof(*dest));
+ }
+
+ template<
+ ss_typename_param_k T
+ >
+ static void pod_move_n_(
+ T* dest
+ , T const* src
+ , ss_size_t n
+ , yes_type
+ )
+ {
+ ::memmove(dest, src, n * sizeof(*dest));
+ }
+
+
+ // Different-type operations
+ //
+ // - ptr-to-ptr is fine
+ // - int-to-int is fine
+
+ template<
+ ss_typename_param_k O
+ , ss_typename_param_k I
+ >
+ static void pod_copy_n_(
+ O* dest
+ , I const* src
+ , ss_size_t n
+ , no_type
+ )
+ {
+ enum { O_IS_INTEGRAL_TYPE = (0 != is_integral_type<O>::value) };
+ enum { I_IS_INTEGRAL_TYPE = (0 != is_integral_type<I>::value) };
+ enum { O_IS_POINTER_TYPE = (0 != is_pointer_type<O>::value) };
+ enum { I_IS_POINTER_TYPE = (0 != is_pointer_type<I>::value) };
+
+ STLSOFT_STATIC_ASSERT(sizeof(*dest) == sizeof(*src));
+ STLSOFT_STATIC_ASSERT(int(O_IS_INTEGRAL_TYPE) == int(I_IS_INTEGRAL_TYPE));
+ STLSOFT_STATIC_ASSERT(int(O_IS_POINTER_TYPE) == int(I_IS_POINTER_TYPE));
+
+ ::memcpy(dest, src, n * sizeof(*dest));
+ }
+
+ template<
+ ss_typename_param_k O
+ , ss_typename_param_k I
+ >
+ static void pod_move_n_(
+ O* dest
+ , I const* src
+ , ss_size_t n
+ , no_type
+ )
+ {
+ enum { O_IS_INTEGRAL_TYPE = (0 != is_integral_type<O>::value) };
+ enum { I_IS_INTEGRAL_TYPE = (0 != is_integral_type<I>::value) };
+ enum { O_IS_POINTER_TYPE = (0 != is_pointer_type<O>::value) };
+ enum { I_IS_POINTER_TYPE = (0 != is_pointer_type<I>::value) };
+
+ STLSOFT_STATIC_ASSERT(sizeof(*dest) == sizeof(*src));
+ STLSOFT_STATIC_ASSERT(int(O_IS_INTEGRAL_TYPE) == int(I_IS_INTEGRAL_TYPE));
+ STLSOFT_STATIC_ASSERT(int(O_IS_POINTER_TYPE) == int(I_IS_POINTER_TYPE));
+
+ ::memmove(dest, src, n * sizeof(*dest));
+ }
+
+};
+#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
+
+/* /////////////////////////////////////////////////////////////////////////
* Algorithms
*/
@@ -134,26 +232,23 @@ inline void pod_copy(I* first, I* last, O* dest)
{
#if defined(STLSOFT_COMPILER_IS_BORLAND) || \
defined(STLSOFT_COMPILER_IS_DMC)
+
std_copy(&first[0], &last[0], &dest[0]);
+
#else /* ? compiler */
+
STLSOFT_STATIC_ASSERT(sizeof(*dest) == sizeof(*first));
-# if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
- // Both must be non-pointers, or must point to POD types
- typedef ss_typename_type_k base_type_traits<I>::base_type i_base_type;
- typedef ss_typename_type_k base_type_traits<O>::base_type o_base_type;
+ stlsoft_constraint_must_be_pod(O);
+ stlsoft_constraint_must_be_pod(I);
+
+ enum { TYPES_ARE_SAME = is_same_type<I, O>::value };
-# ifndef _STLSOFT_POD_COPY_ALLOW_NON_POD
- stlsoft_constraint_must_be_pod(i_base_type);
- stlsoft_constraint_must_be_pod(o_base_type);
-# endif /* !_STLSOFT_POD_COPY_ALLOW_NON_POD */
-# endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
+ typedef ss_typename_type_k value_to_yesno_type<TYPES_ARE_SAME>::type yesno_t;
ss_size_t n = static_cast<ss_size_t>(last - first);
- if(0 != n)
- {
- ::memcpy(&dest[0], &first[0], n * sizeof(*first));
- }
+ ximpl_stlsoft_algorithm_pod_helper_::pod_copy_n_(dest, first, n, yesno_t());
+
#endif /* compiler */
}
@@ -190,24 +285,21 @@ inline void pod_copy_n(O *dest, I *src, ss_size_t n)
{
#if defined(STLSOFT_COMPILER_IS_BORLAND) || \
defined(STLSOFT_COMPILER_IS_DMC)
+
std_copy(&src[0], &src[n], &dest[0]);
+
#else /* ? compiler */
+
STLSOFT_STATIC_ASSERT(sizeof(*dest) == sizeof(*src));
-# if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
- // Both must be non-pointers, or must point to POD types
- typedef ss_typename_type_k base_type_traits<I>::base_type i_base_type;
- typedef ss_typename_type_k base_type_traits<O>::base_type o_base_type;
-
-# ifndef _STLSOFT_POD_COPY_N_ALLOW_NON_POD
- stlsoft_constraint_must_be_pod(i_base_type);
- stlsoft_constraint_must_be_pod(o_base_type);
-# endif /* !_STLSOFT_POD_COPY_N_ALLOW_NON_POD */
-# endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
-
- if(0 != n)
- {
- ::memcpy(&dest[0], &src[0], n * sizeof(*dest));
- }
+ stlsoft_constraint_must_be_pod(O);
+ stlsoft_constraint_must_be_pod(I);
+
+ enum { TYPES_ARE_SAME = is_same_type<I, O>::value };
+
+ typedef ss_typename_type_k value_to_yesno_type<TYPES_ARE_SAME>::type yesno_t;
+
+ ximpl_stlsoft_algorithm_pod_helper_::pod_copy_n_(dest, src, n, yesno_t());
+
#endif /* compiler */
}
@@ -238,26 +330,23 @@ inline void pod_move(I* first, I* last, O* dest)
{
#if defined(STLSOFT_COMPILER_IS_BORLAND) || \
defined(STLSOFT_COMPILER_IS_DMC)
+
std_copy(&first[0], &last[0], &dest[0]);
+
#else /* ? compiler */
- STLSOFT_STATIC_ASSERT(sizeof(*first) == sizeof(*dest));
-# if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
- // Both must be non-pointers, or must point to POD types
- typedef ss_typename_type_k base_type_traits<I>::base_type i_base_type;
- typedef ss_typename_type_k base_type_traits<O>::base_type o_base_type;
-
-# ifndef _STLSOFT_POD_MOVE_ALLOW_NON_POD
- stlsoft_constraint_must_be_pod(i_base_type);
- stlsoft_constraint_must_be_pod(o_base_type);
-# endif /* !_STLSOFT_POD_MOVE_ALLOW_NON_POD */
-# endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
+
+ STLSOFT_STATIC_ASSERT(sizeof(*dest) == sizeof(*first));
+ stlsoft_constraint_must_be_pod(O);
+ stlsoft_constraint_must_be_pod(I);
+
+ enum { TYPES_ARE_SAME = is_same_type<I, O>::value };
+
+ typedef ss_typename_type_k value_to_yesno_type<TYPES_ARE_SAME>::type yesno_t;
ss_size_t n = static_cast<ss_size_t>(last - first);
- if(0 != n)
- {
- ::memmove(dest, first, n * sizeof(*first));
- }
+ ximpl_stlsoft_algorithm_pod_helper_::pod_move_n_(dest, first, n, yesno_t());
+
#endif /* compiler */
}
@@ -287,24 +376,21 @@ inline void pod_move_n(O *dest, I *src, ss_size_t n)
{
#if defined(STLSOFT_COMPILER_IS_BORLAND) || \
defined(STLSOFT_COMPILER_IS_DMC)
+
std_copy(&src[0], &src[n], &dest[0]);
+
#else /* ? compiler */
+
STLSOFT_STATIC_ASSERT(sizeof(*dest) == sizeof(*src));
-# if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
- // Both must be non-pointers, or must point to POD types
- typedef ss_typename_type_k base_type_traits<I>::base_type i_base_type;
- typedef ss_typename_type_k base_type_traits<O>::base_type o_base_type;
-
-# ifndef _STLSOFT_POD_MOVE_N_ALLOW_NON_POD
- stlsoft_constraint_must_be_pod(i_base_type);
- stlsoft_constraint_must_be_pod(o_base_type);
-# endif /* !_STLSOFT_POD_MOVE_N_ALLOW_NON_POD */
-# endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
-
- if(0 != n)
- {
- ::memmove(&dest[0], &src[0], n * sizeof(*dest));
- }
+ stlsoft_constraint_must_be_pod(O);
+ stlsoft_constraint_must_be_pod(I);
+
+ enum { TYPES_ARE_SAME = is_same_type<I, O>::value };
+
+ typedef ss_typename_type_k value_to_yesno_type<TYPES_ARE_SAME>::type yesno_t;
+
+ ximpl_stlsoft_algorithm_pod_helper_::pod_move_n_(dest, src, n, yesno_t());
+
#endif /* compiler */
}
@@ -341,13 +427,7 @@ template< ss_typename_param_k T
inline void pod_fill_n(T *dest, ss_size_t n, V const& value)
{
// Constrain to POD type:
-# if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
- typedef ss_typename_type_k base_type_traits<T>::base_type base_type;
-
-# ifndef _STLSOFT_POD_FILL_N_ALLOW_NON_POD
- stlsoft_constraint_must_be_pod(base_type);
-# endif /* !_STLSOFT_POD_FILL_N_ALLOW_NON_POD */
-# endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
+ stlsoft_constraint_must_be_pod(T);
std_fill_n(dest, n, value);
}
View
56 include/stlsoft/algorithms/std/alt.hpp
@@ -5,7 +5,7 @@
* do or do not have a standard library.
*
* Created: 17th January 2002
- * Updated: 10th February 2010
+ * Updated: 15th July 2010
*
* Home: http://stlsoft.org/
*
@@ -56,7 +56,7 @@
# define STLSOFT_VER_STLSOFT_ALGORITHMS_STD_HPP_ALT_MAJOR 3
# define STLSOFT_VER_STLSOFT_ALGORITHMS_STD_HPP_ALT_MINOR 4
# define STLSOFT_VER_STLSOFT_ALGORITHMS_STD_HPP_ALT_REVISION 4
-# define STLSOFT_VER_STLSOFT_ALGORITHMS_STD_HPP_ALT_EDIT 76
+# define STLSOFT_VER_STLSOFT_ALGORITHMS_STD_HPP_ALT_EDIT 77
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -167,8 +167,11 @@ template<ss_typename_param_k I>
void std_advance(I &i, ss_ptrdiff_t n)
{
#ifdef STLSOFT_CF_std_NAMESPACE
+
stlsoft_ns_qual_std(advance)(i, n);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
# ifdef STLSOFT_CF_NAMESPACE_SUPPORT
using std_alt_algorithms_util_::std_advance_impl;
# if !defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT)
@@ -181,6 +184,7 @@ void std_advance(I &i, ss_ptrdiff_t n)
# else /* ? STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
std_advance_impl(i, n, is_ptr_(i, &i));
# endif /* STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT */
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -196,14 +200,18 @@ inline O std_copy(I first, I last, O dest)
{
#if defined(STLSOFT_CF_std_NAMESPACE) && \
!defined(STLSOFT_USING_SAFE_STR_FUNCTIONS)
+
return stlsoft_ns_qual_std(copy)(first, last, dest);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; first != last; ++first, ++dest)
{
*dest = *first;
}
return dest;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -218,8 +226,11 @@ template< ss_typename_param_k I
inline ss_size_t std_count_if(I first, I last, UP pred)
{
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(count_if)(first, last, pred);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
ss_size_t r;
for (r = 0; first != last; ++first)
@@ -231,6 +242,7 @@ inline ss_size_t std_count_if(I first, I last, UP pred)
}
return r;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -245,12 +257,16 @@ template< ss_typename_param_k O
inline void std_fill(O first, O last, V const& value)
{
#ifdef STLSOFT_CF_std_NAMESPACE
+
stlsoft_ns_qual_std(fill)(first, last, value);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; first != last; ++first)
{
*first = value;
}
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -266,12 +282,16 @@ inline void std_fill_n(O dest, ss_size_t n, V const& value)
{
#if defined(STLSOFT_CF_std_NAMESPACE) && \
!defined(STLSOFT_USING_SAFE_STR_FUNCTIONS)
+
stlsoft_ns_qual_std(fill_n)(dest, n, value);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; 0 != n; ++dest, --n)
{
*dest = value;
}
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -286,8 +306,11 @@ template< ss_typename_param_k I
inline I std_find(I first, I last, V const& value)
{
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(find)(first, last, value);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; first != last; ++first)
{
if(value == *first)
@@ -297,6 +320,7 @@ inline I std_find(I first, I last, V const& value)
}
return first;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -311,8 +335,11 @@ template< ss_typename_param_k I
inline I std_find_if(I first, I last, UP pred)
{
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(find_if)(first, last, pred);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; first != last; ++first)
{
if(pred(*first))
@@ -322,6 +349,7 @@ inline I std_find_if(I first, I last, UP pred)
}
return first;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -336,14 +364,18 @@ template< ss_typename_param_k I
inline UF std_for_each(I first, I last, UF func)
{
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(for_each)(first, last, func);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; first != last; ++first)
{
func(*first);
}
return func;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -418,14 +450,18 @@ inline O std_transform(I first, I last, O dest, UF func)
{
#if defined(STLSOFT_CF_std_NAMESPACE) && \
!defined(STLSOFT_USING_SAFE_STR_FUNCTIONS)
+
return stlsoft_ns_qual_std(transform)(first, last, dest, func);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
for(; first != last; ++first, ++dest)
{
*dest = func(*first);
}
return dest;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -444,8 +480,11 @@ inline FI std_unique(FI first, FI last, BP pred)
#endif /* STLSOFT_ENFORCE_ORDERING */
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(unique)(first, last, pred);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
if(first != last)
{
# ifdef _DEBUG
@@ -473,6 +512,7 @@ inline FI std_unique(FI first, FI last, BP pred)
}
return first;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -489,8 +529,11 @@ inline FI std_unique(FI first, FI last)
#endif /* STLSOFT_ENFORCE_ORDERING */
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(unique)(first, last);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
if(first != last)
{
# ifdef _DEBUG
@@ -518,6 +561,7 @@ inline FI std_unique(FI first, FI last)
}
return first;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -536,8 +580,11 @@ inline OI std_unique_copy(FI first, FI last, OI dest)
#endif /* STLSOFT_ENFORCE_ORDERING */
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(unique_copy)(first, last, dest);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
if(first != last)
{
# ifdef _DEBUG
@@ -563,6 +610,7 @@ inline OI std_unique_copy(FI first, FI last, OI dest)
}
return dest;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
@@ -582,8 +630,11 @@ inline OI std_unique_copy(FI first, FI last, OI dest, BP pred)
#endif /* STLSOFT_ENFORCE_ORDERING */
#ifdef STLSOFT_CF_std_NAMESPACE
+
return stlsoft_ns_qual_std(unique_copy)(first, last, dest, pred);
+
#else /* ? STLSOFT_CF_std_NAMESPACE */
+
if(first != last)
{
# ifdef _DEBUG
@@ -609,6 +660,7 @@ inline OI std_unique_copy(FI first, FI last, OI dest, BP pred)
}
return dest;
+
#endif /* STLSOFT_CF_std_NAMESPACE */
}
View
13 include/stlsoft/error/error_desc.hpp
@@ -4,7 +4,7 @@
* Purpose: Converts a standard rerror code (errno) to a printable string.
*
* Created: 18th July 2006
- * Updated: 21st June 2010
+ * Updated: 12th August 2010
*
* Home: http://stlsoft.org/
*
@@ -52,8 +52,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_ERROR_HPP_ERROR_DESC_MAJOR 1
# define STLSOFT_VER_STLSOFT_ERROR_HPP_ERROR_DESC_MINOR 2
-# define STLSOFT_VER_STLSOFT_ERROR_HPP_ERROR_DESC_REVISION 4
-# define STLSOFT_VER_STLSOFT_ERROR_HPP_ERROR_DESC_EDIT 23
+# define STLSOFT_VER_STLSOFT_ERROR_HPP_ERROR_DESC_REVISION 5
+# define STLSOFT_VER_STLSOFT_ERROR_HPP_ERROR_DESC_EDIT 24
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -92,9 +92,10 @@
# include <wchar.h> // for wcslen()
#endif /* !STLSOFT_INCL_H_WCHAR */
-#ifdef STLSOFT_UNITTEST
+#ifndef STLSOFT_INCL_H_ERRNO
+# define STLSOFT_INCL_H_ERRNO
# include <errno.h>
-#endif /* STLSOFT_UNITTEST */
+#endif /* !STLSOFT_INCL_H_ERRNO */
/* /////////////////////////////////////////////////////////////////////////
* Compatibility
@@ -214,7 +215,7 @@ struct error_desc_traits<ss_char_w_t>
if(size_t(-1) == n)
{
- return return_t(L"could not determine error");
+ return return_t(L"could not determine error");
}
return ss;
View
4 include/stlsoft/iterators/associative_select_iterator.hpp
@@ -82,7 +82,7 @@
#endif /* !STLSOFT_INCL_STLSOFT_UTIL_STD_HPP_ITERATOR_HELPER */
#if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT) && \
- !defined(STLSOFT_COMPILER_IS_BORLAND)
+ !defined(STLSOFT_COMPILER_IS_BORLAND)
# ifndef STLSOFT_INCL_STLSOFT_ITERATOR_HPP_ADAPTED_ITERATOR_TRAITS
# include <stlsoft/iterators/adapted_iterator_traits.hpp>
# endif /* !STLSOFT_INCL_STLSOFT_ITERATOR_HPP_ADAPTED_ITERATOR_TRAITS */
@@ -314,7 +314,7 @@ inline associative_select_iterator<I, F> associative_select(I i, F f)
}
#if defined(STLSOFT_CF_TEMPLATE_PARTIAL_SPECIALISATION_SUPPORT) && \
- !defined(STLSOFT_COMPILER_IS_BORLAND)
+ !defined(STLSOFT_COMPILER_IS_BORLAND)
/** Creates an instance of associative_select_iterator that selects the
* \c first member.
View
100 include/stlsoft/iterators/common/string_concatenation_flags.hpp
@@ -0,0 +1,100 @@
+/* /////////////////////////////////////////////////////////////////////////
+ * File: stlsoft/iterators/common/string_concatenation_flags.hpp
+ *
+ * Purpose: Common flags for use with string_concatenator_iterator and
+ * c_string_concatenator_iterator.
+ *
+ * Created: 31st July 2010
+ * Updated: 31st July 2010
+ *
+ * Home: http://stlsoft.org/
+ *
+ * Copyright (c) 2010, Matthew Wilson and Synesis Software
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
+ * any contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ////////////////////////////////////////////////////////////////////// */
+
+
+/** \file stlsoft/iterators/common/string_concatenation_flags.hpp
+ *
+ * \brief [C++ only] Common flags for use with string_concatenator_iterator and
+ * c_string_concatenator_iterator.
+ * (\ref group__library__iterators "Iterators" Library).
+ */
+
+#ifndef STLSOFT_INCL_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS
+#define STLSOFT_INCL_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS
+
+#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
+# define STLSOFT_VER_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS_MAJOR 1
+# define STLSOFT_VER_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS_MINOR 0
+# define STLSOFT_VER_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS_REVISION 1
+# define STLSOFT_VER_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS_EDIT 1
+#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
+
+/* /////////////////////////////////////////////////////////////////////////
+ * Includes
+ */
+
+#ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
+# include <stlsoft/stlsoft.h>
+#endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
+
+/* /////////////////////////////////////////////////////////////////////////
+ * Namespace
+ */
+
+#ifndef _STLSOFT_NO_NAMESPACE
+namespace stlsoft
+{
+#endif /* _STLSOFT_NO_NAMESPACE */
+
+/* /////////////////////////////////////////////////////////////////////////
+ * Flags
+ */
+
+struct string_concatenation_flags
+{
+ enum
+ {
+ /// Causes string concatenation to always insert the separator, even
+ /// between empty elements
+ AlwaysSeparate = 0x0001,
+ };
+};
+
+/* ////////////////////////////////////////////////////////////////////// */
+
+#ifndef _STLSOFT_NO_NAMESPACE
+} // namespace stlsoft
+#endif /* _STLSOFT_NO_NAMESPACE */
+
+/* ////////////////////////////////////////////////////////////////////// */
+
+#endif /* !STLSOFT_INCL_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS */
+
+/* ///////////////////////////// end of file //////////////////////////// */
View
117 include/stlsoft/iterators/string_concatenator_iterator.hpp
@@ -4,11 +4,11 @@
* Purpose: string_concatenator_iterator class template.
*
* Created: 12th May 1998
- * Updated: 10th August 2009
+ * Updated: 31st July 2010
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 1998-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 1998-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,9 +50,9 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_MAJOR 2
-# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_MINOR 3
-# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_REVISION 3
-# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_EDIT 41
+# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_MINOR 4
+# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_REVISION 1
+# define STLSOFT_VER_STLSOFT_ITERATORS_HPP_STRING_CONCATENATOR_ITERATOR_EDIT 42
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -72,6 +72,9 @@
#ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
# include <stlsoft/stlsoft.h>
#endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
+#ifndef STLSOFT_INCL_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS
+# include <stlsoft/iterators/common/string_concatenation_flags.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_ITERATORS_COMMON_HPP_STRING_CONCATENATION_FLAGS */
#ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
# include <stlsoft/shims/access/string.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
@@ -141,14 +144,24 @@ class string_concatenator_iterator
_MSC_VER < 1310
public:
#endif /* compiler */
- string_concatenator_iterator(string_type* s, delimiter_type const* delim)
+ string_concatenator_iterator(
+ string_type* s
+ , delimiter_type const* delim
+ , int flags
+ )
: m_s(s)
, m_delim(delim)
+ , m_flags(flags)
+ , m_count(0)
{}
public:
- static class_type create(string_type& s, delimiter_type const& delim)
+ static class_type create(
+ string_type& s
+ , delimiter_type const& delim
+ , int flags
+ )
{
- return class_type(&s, &delim);
+ return class_type(&s, &delim, flags);
}
private:
class deref_proxy;
@@ -220,7 +233,7 @@ class string_concatenator_iterator
template <ss_typename_param_k C2>
void invoke_(C2 const* value)
{
- this->invoke_(value, *value);
+ this->invoke_(value, *value);
}
#endif /* ? compiler */
@@ -245,12 +258,34 @@ class string_concatenator_iterator
STLSOFT_ASSERT(NULL != m_s);
STLSOFT_ASSERT(NULL != m_delim);
- if(0 != c_str_len(*m_s))
+ bool const valueEmpty = (0u == c_str_len(value));
+
+ if( valueEmpty &&
+ 0 == (string_concatenation_flags::AlwaysSeparate & m_flags))
{
- // NOTE: Use +=, as it's the most general
- *m_s += c_str_ptr_a(*m_delim);
+ ;
}
- *m_s += c_str_ptr_a(value);
+ else
+ {
+ bool const stringEmpty = (0u == c_str_len(*m_s));
+
+ if(stringEmpty)
+ {
+ if( 0 != m_count &&
+ 0 != (string_concatenation_flags::AlwaysSeparate & m_flags))
+ {
+ *m_s += c_str_ptr_a(*m_delim);
+ }
+ }
+ else
+ {
+ // NOTE: Use +=, as it's the most general
+ *m_s += c_str_ptr_a(*m_delim);
+ }
+ *m_s += c_str_ptr_a(value);
+ }
+
+ ++m_count;
}
template <ss_typename_param_k S3>
void invoke_(S3 const& value, ss_char_w_t)
@@ -258,12 +293,34 @@ class string_concatenator_iterator
STLSOFT_ASSERT(NULL != m_s);
STLSOFT_ASSERT(NULL != m_delim);
- if(0 != c_str_len(*m_s))
+ bool const valueEmpty = (0u == c_str_len(value));
+
+ if( valueEmpty &&
+ 0 == (string_concatenation_flags::AlwaysSeparate & m_flags))
{
- // NOTE: Use +=, as it's the most general
- *m_s += c_str_ptr_w(*m_delim);
+ ;
}
- *m_s += c_str_ptr_w(value);
+ else
+ {
+ bool const stringEmpty = (0u == c_str_len(*m_s));
+
+ if(stringEmpty)
+ {
+ if( 0 != m_count &&
+ 0 != (string_concatenation_flags::AlwaysSeparate & m_flags))
+ {
+ *m_s += c_str_ptr_w(*m_delim);
+ }
+ }
+ else
+ {
+ // NOTE: Use +=, as it's the most general
+ *m_s += c_str_ptr_w(*m_delim);
+ }
+ *m_s += c_str_ptr_w(value);
+ }
+
+ ++m_count;
}
#endif /* 0 */
/// @}
@@ -271,8 +328,10 @@ class string_concatenator_iterator
/// \name Member Variables
/// @{
private:
- string_type *m_s;
- delimiter_type const *m_delim;
+ string_type* m_s;
+ delimiter_type const* m_delim;
+ int m_flags;
+ unsigned m_count;
/// @}
};
@@ -292,9 +351,14 @@ class string_concatenator_iterator
template< ss_typename_param_k S
, ss_typename_param_k D
>
-inline string_concatenator_iterator<S, D> make_string_concatenator_iterator(S& s, D const& delim)
+inline string_concatenator_iterator<S, D>
+make_string_concatenator_iterator(
+ S& s
+, D const& delim
+, int flags = 0
+)
{
- return string_concatenator_iterator<S, D>::create(s, delim);
+ return string_concatenator_iterator<S, D>::create(s, delim, flags);
}
/** \brief Creator function for string_concatenator_iterator
@@ -311,13 +375,18 @@ inline string_concatenator_iterator<S, D> make_string_concatenator_iterator(S& s
template< ss_typename_param_k S
, ss_typename_param_k D
>
-inline string_concatenator_iterator<S, D> string_concatenator(S& s, D const& delim)
+inline string_concatenator_iterator<S, D>
+string_concatenator(
+ S& s
+, D const& delim
+, int flags = 0
+)
{
#if defined(STLSOFT_COMPILER_IS_INTEL) || \
defined(STLSOFT_COMPILER_IS_MSVC)
- return string_concatenator_iterator<S, D>::create(s, delim);
+ return string_concatenator_iterator<S, D>::create(s, delim, flags);
#else /* ? compiler */
- return make_string_concatenator_iterator(s, delim);
+ return make_string_concatenator_iterator(s, delim, flags);
#endif /* compiler */
}
View
77 include/stlsoft/performance/performance_counter_init.hpp
@@ -4,36 +4,37 @@
* Purpose: Performance counter initialising class.
*
* Created: 30th July 2002
- * Updated: 10th August 2009
+ * Updated: 29th July 2010
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 2002-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
+ * modification, are permitted provided that the following conditions are
+ * met:
*
- * - Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
- * any contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
+ * names of any contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ////////////////////////////////////////////////////////////////////// */
@@ -50,9 +51,9 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_HPP_PERFORMANCE_COUNTER_INIT_MAJOR 4
-# define STLSOFT_VER_STLSOFT_HPP_PERFORMANCE_COUNTER_INIT_MINOR 0
+# define STLSOFT_VER_STLSOFT_HPP_PERFORMANCE_COUNTER_INIT_MINOR 1
# define STLSOFT_VER_STLSOFT_HPP_PERFORMANCE_COUNTER_INIT_REVISION 1
-# define STLSOFT_VER_STLSOFT_HPP_PERFORMANCE_COUNTER_INIT_EDIT 34
+# define STLSOFT_VER_STLSOFT_HPP_PERFORMANCE_COUNTER_INIT_EDIT 36
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -77,7 +78,7 @@ namespace stlsoft
*/
// class performance_counter_initialiser
-/** \brief A \ref group__pattern__class_adaptor "class adaptor" that
+/** A \ref group__pattern__class_adaptor "class adaptor" that
* initialises a performance counter.
*
* \ingroup group__library__performance
@@ -91,22 +92,38 @@ class performance_counter_initialiser
/// \name Member Types
/// @{
public:
- /// \brief The counter type
- typedef C counter_type;
- /// \brief The class type
- typedef performance_counter_initialiser<C> class_type;
+ /// The counter type
+ typedef C counter_type;
+ /// The class type
+ typedef performance_counter_initialiser<C> class_type;
+ /// The interval type
+ typedef ss_typename_type_k counter_type::interval_type interval_type;
/// @}
/// \name Construction
/// @{
public:
- /// \brief Initialises the counter by calling start() and stop() on it.
+ /// Initialises the counter by calling start() and stop() on it.
performance_counter_initialiser()
{
counter_type::start();
counter_type::stop();
}
/// @}
+
+/// \name Operations
+/// @{
+public:
+ /// Terminates and measures the current sampling period, and commences
+ /// another.
+ interval_type get_period_and_restart(interval_type (class_type::*pmfn)(void) const)
+ {
+ counter_type::stop();
+ interval_type r = (this->*pmfn)();
+ counter_type::start();
+ return r;
+ }
+/// @}
};
/* ////////////////////////////////////////////////////////////////////// */
View
71 include/stlsoft/stlsoft.h
@@ -6,7 +6,7 @@
* types.
*
* Created: 15th January 2002
- * Updated: 21st June 2010
+ * Updated: 29th July 2010
*
* Home: http://stlsoft.org/
*
@@ -53,9 +53,9 @@
/* File version */
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_H_STLSOFT_MAJOR 3
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_MINOR 22
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 5
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 406
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_MINOR 23
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 1
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 407
#else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* # include "./internal/doxygen_defs.h" */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
@@ -262,12 +262,13 @@
# define _STLSOFT_VER_1_9_97 0x010961ff /*!< Version 1.9.97 (3rd April 2010) */
# define _STLSOFT_VER_1_9_98 0x010962ff /*!< Version 1.9.98 (7th June 2010) */
# define _STLSOFT_VER_1_9_99 0x010963ff /*!< Version 1.9.99 (21st June 2010) */
+# define _STLSOFT_VER_1_9_100 0x010964ff /*!< Version 1.9.100 (29th July 2010) */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
#define _STLSOFT_VER_MAJOR 1
#define _STLSOFT_VER_MINOR 9
-#define _STLSOFT_VER_REVISION 99
-#define _STLSOFT_VER _STLSOFT_VER_1_9_99
+#define _STLSOFT_VER_REVISION 100
+#define _STLSOFT_VER _STLSOFT_VER_1_9_100
/* /////////////////////////////////////////////////////////////////////////
* Basic macros
@@ -747,9 +748,9 @@
*/
#if defined(STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT)
-# define STLSOFT_FUNCTION_SYMBOL __FUNCTION__
+# define STLSOFT_FUNCTION_SYMBOL __FUNCTION__
#elif defined(STLSOFT_CF_func_SYMBOL_SUPPORT)
-# define STLSOFT_FUNCTION_SYMBOL __func__
+# define STLSOFT_FUNCTION_SYMBOL __func__
#endif /* __FUNCTION__ or __func__ */
/* /////////////////////////////////////////////////////////////////////////
@@ -1000,18 +1001,66 @@
/* Calling convention facility values */
+/** \def STLSOFT_CC_CDECL_VALUE
+ *
+ * An unique (flag) integer value set to
+ * <code>0x01</code>
+ * if the
+ * <strong>cdecl</strong>
+ * calling convention is supported, otherwise set to
+ * <code>0</code>.
+ */
+
+/** \def STLSOFT_CC_FASTCALL_VALUE
+ *
+ * An unique (flag) integer value set to
+ * <code>0x02</code>
+ * if the
+ * <strong>fastcall</strong>
+ * calling convention is supported, otherwise set to
+ * <code>0</code>.
+ */
+
+/** \def STLSOFT_CC_STDCALL_VALUE
+ *
+ * An unique (flag) integer value set to
+ * <code>0x04</code>
+ * if the
+ * <strong>stdcall</strong>
+ * calling convention is supported, otherwise set to
+ * <code>0</code>.
+ */
+
+/** \def STLSOFT_CC_COMBINED_VALUE
+ *
+ * Combination of STLSOFT_CC_CDECL_VALUE, STLSOFT_CC_FASTCALL_VALUE
+ * and STLSOFT_CC_STDCALL_VALUE.
+ */
+
#if defined(STLSOFT_CF_CDECL_SUPPORTED)
-# define STLSOFT_CDECL_VALUE (1) /*!< \brief A unique value indicating <b>cdecl</b> calling convention. */
+# define STLSOFT_CDECL_VALUE (1) /*!< \deprecated This symbol is deprecated, and will be removed from a future version */
+# define STLSOFT_CC_CDECL_VALUE (0x01)
+#else
+# define STLSOFT_CC_CDECL_VALUE (0)
#endif /* STLSOFT_CF_CDECL_SUPPORTED */
#if defined(STLSOFT_CF_FASTCALL_SUPPORTED)
-# define STLSOFT_FASTCALL_VALUE (2) /*!< \brief A unique value indicating <b>fastcall</b> calling convention. */
+# define STLSOFT_FASTCALL_VALUE (2) /*!< \deprecated This symbol is deprecated, and will be removed from a future version */
+# define STLSOFT_CC_FASTCALL_VALUE (0x02)
+#else
+# define STLSOFT_CC_FASTCALL_VALUE (0)
#endif /* STLSOFT_CF_FASTCALL_SUPPORTED */
#if defined(STLSOFT_CF_STDCALL_SUPPORTED)
-# define STLSOFT_STDCALL_VALUE (3) /*!< \brief A unique value indicating <b>stdcall</b> calling convention. */
+# define STLSOFT_STDCALL_VALUE (3) /*!< \deprecated This symbol is deprecated, and will be removed from a future version */
+# define STLSOFT_CC_STDCALL_VALUE (0x04)
+#else
+# define STLSOFT_CC_STDCALL_VALUE (0)
#endif /* STLSOFT_CF_STDCALL_SUPPORTED */
+#define STLSOFT_CC_COMBINED_VALUE (STLSOFT_CC_CDECL_VALUE | STLSOFT_CC_FASTCALL_VALUE | STLSOFT_CC_STDCALL_VALUE)
+
+
/* /////////////////////////////////////////////////////////////////////////
* operator bool()
*
View
43 include/stlsoft/string/special_string_instance.hpp
@@ -4,7 +4,7 @@
* Purpose: Special string instance class template.
*
* Created: 3rd June 2006
- * Updated: 21st June 2010
+ * Updated: 12th August 2010
*
* Thanks to: Pablo Aguilar for spotting my omission of string access shims
* for special_string_instance_1.
@@ -54,9 +54,9 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_MAJOR 1
-# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_MINOR 2
-# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_REVISION 6
-# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_EDIT 20
+# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_MINOR 3
+# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_REVISION 1
+# define STLSOFT_VER_STLSOFT_STRING_HPP_SPECIAL_STRING_INSTANCE_EDIT 22
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -139,7 +139,7 @@ struct ssi_buffer
, N
#endif /* compiler */
, allocator_type
- > buffer_type_;
+ > buffer_type_;
/// @}
/// \name Construction
@@ -151,16 +151,18 @@ struct ssi_buffer
{}
#ifdef STLSOFT_COMPILER_IS_GCC
ssi_buffer(class_type const& rhs)
- : m_len(rhs.m_len)
- , m_buffer(rhs.m_len + 1)
- {
- ::memcpy(&m_buffer[0], &rhs.m_buffer[0], sizeof(char_type) * (1u + m_len));
- }
+ : m_len(rhs.m_len)
+ , m_buffer(rhs.m_len + 1)
+ {
+ ::memcpy(&m_buffer[0], &rhs.m_buffer[0], sizeof(char_type) * (1u + m_len));
+ }
#endif /* compiler */
void init(size_type (*pfn)(char_type*, size_type))
{
- size_type cch = pfn(NULL, 0); // We don't pass NULL here, just in case
+ // We don't pass NULL here, just in case
+ char_type empty = '\0';
+ size_type cch = pfn(&empty, 0);
if(m_buffer.resize(1 + cch))
{
@@ -270,8 +272,8 @@ struct ssi_buffer_non_static
}
#ifdef STLSOFT_COMPILER_IS_GCC
ssi_buffer_non_static(class_type const& rhs)
- : parent_class_type(rhs)
- {}
+ : parent_class_type(rhs)
+ {}
#endif /* compiler */
/// @}
@@ -317,6 +319,7 @@ struct ssi_buffer_static
private:
typedef P policy_type;
typedef ss_typename_type_k policy_type::spin_mutex_type spin_mutex_type;
+ typedef ss_typename_type_k policy_type::atomic_int_type atomic_int_type;
/// @}
/// \name Construction
@@ -330,8 +333,8 @@ struct ssi_buffer_static
{}
#ifdef STLSOFT_COMPILER_IS_GCC
ssi_buffer_static(class_type const& rhs)
- : m_buffer(rhs.m_buffer)
- {}
+ : m_buffer(rhs.m_buffer)
+ {}
#endif /* compiler */
/// @}
@@ -351,9 +354,9 @@ struct ssi_buffer_static
/// \name Implementation
/// @{
private:
- static ssi_buffer_type &get_buffer(size_type (*pfn)(char_type*, size_type))
+ static ssi_buffer_type& get_buffer(size_type (*pfn)(char_type*, size_type))
{
- static ss_sint32_t s_count = 0;
+ static atomic_int_type s_count = 0;
static bool s_bInit = false;
spin_mutex_type mx(&s_count);
stlsoft::lock_scope<spin_mutex_type> lock(mx);
@@ -369,9 +372,9 @@ struct ssi_buffer_static
return s_buffer;
}
- static ssi_buffer_type &get_buffer(A0 a0, size_type (*pfn)(A0, char_type*, size_type))
+ static ssi_buffer_type& get_buffer(A0 a0, size_type (*pfn)(A0, char_type*, size_type))
{
- static ss_sint32_t s_count = 0;
+ static atomic_int_type s_count = 0;
static bool s_bInit = false;
spin_mutex_type mx(&s_count);
stlsoft::lock_scope<spin_mutex_type> lock(mx);
@@ -392,7 +395,7 @@ struct ssi_buffer_static
/// \name Members
/// @{
private:
- ssi_buffer_type& m_buffer;
+ ssi_buffer_type& m_buffer;
/// @}
/// \name Not to be implemented
View
10 include/stlsoft/string/string_tokeniser.hpp
@@ -4,11 +4,11 @@
* Purpose: String token parsing class.
*
* Created: 6th January 2001
- * Updated: 10th August 2009
+ * Updated: 31st July 2010
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2001-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 2001-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,8 +51,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TOKENISER_MAJOR 5
# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TOKENISER_MINOR 1
-# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TOKENISER_REVISION 7
-# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TOKENISER_EDIT 221
+# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TOKENISER_REVISION 8
+# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_TOKENISER_EDIT 222
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -803,7 +803,7 @@ class string_tokeniser
/// Dereference operator
//
// This has to be V, rather than value_type, because Visual C++ thinks that S is the value_type!!
- V operator *() const
+ const V operator *() const
{
return traits_type::create(m_find0, m_find1);
}
View
28 include/stlsoft/string/string_view.hpp
@@ -4,7 +4,7 @@
* Purpose: basic_string_view class.
*
* Created: 16th October 2004
- * Updated: 10th August 2009
+ * Updated: 10th August 2010
*
* Thanks to: Bjorn Karlsson and Scott Patterson for discussions on various
* naming and design issues. Thanks also to Pablo Aguilar for
@@ -12,7 +12,7 @@
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2004-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 2004-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,8 +55,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_VIEW_MAJOR 3
# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_VIEW_MINOR 3
-# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_VIEW_REVISION 1
-# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_VIEW_EDIT 92
+# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_VIEW_REVISION 3
+# define STLSOFT_VER_STLSOFT_STRING_HPP_STRING_VIEW_EDIT 94
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -1217,7 +1217,7 @@ inline ss_bool_t basic_string_view<C, T, A>::equal(ss_typename_type_k basic_stri
{
STLSOFT_ASSERT(is_valid());
- return (m_length == rhs.m_length) && ((m_base == rhs.m_base) || 0 == compare(rhs));
+ return (m_length == rhs.m_length) && ((m_base == rhs.m_base) || 0 == traits_type::compare(m_base, rhs.m_base, m_length));
}
template< ss_typename_param_k C
@@ -1329,14 +1329,16 @@ inline ss_sint_t basic_string_view<C, T, A>::compare( ss_typename_type_k basic
, ss_typename_type_k basic_string_view<C, T, A>::size_type cchRhs) const stlsoft_throw_0()
{
STLSOFT_ASSERT(is_valid());
+ STLSOFT_ASSERT(pos <= length());
+ STLSOFT_ASSERT(posRhs <= rhs.length());
- size_type lhs_len = length();
+ size_type lhs_len = length();
- if(!(pos < lhs_len))
+ if(pos == lhs_len)
{
- pos = lhs_len;
+ lhs_len = 0u;
}
- else
+ else if(pos + cch > lhs_len)
{
lhs_len -= pos;
}
@@ -1346,13 +1348,13 @@ inline ss_sint_t basic_string_view<C, T, A>::compare( ss_typename_type_k basic
lhs_len = cch;
}
- size_type rhs_len = rhs.length();
+ size_type rhs_len = rhs.length();
- if(!(posRhs < rhs_len))
+ if(posRhs == rhs_len)
{
- posRhs = rhs_len;
+ rhs_len = 0u;
}
- else
+ else if(posRhs + cchRhs > rhs_len)
{
rhs_len -= posRhs;
}
View
18 include/stlsoft/util/constraints.hpp
@@ -4,7 +4,7 @@
* Purpose: Compile-time template constraints templates.
*
* Created: 19th November 1998
- * Updated: 10th August 2009
+ * Updated: 11th August 2010
*
* Thanks: To Peter Bannister for having the clear thinking to see the
* obvious (but only in hindsight) tactic of overloading the
@@ -12,7 +12,7 @@
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 1998-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 1998-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,8 +55,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_UTIL_HPP_CONSTRAINTS_MAJOR 5
# define STLSOFT_VER_STLSOFT_UTIL_HPP_CONSTRAINTS_MINOR 0
-# define STLSOFT_VER_STLSOFT_UTIL_HPP_CONSTRAINTS_REVISION 2
-# define STLSOFT_VER_STLSOFT_UTIL_HPP_CONSTRAINTS_EDIT 97
+# define STLSOFT_VER_STLSOFT_UTIL_HPP_CONSTRAINTS_REVISION 4
+# define STLSOFT_VER_STLSOFT_UTIL_HPP_CONSTRAINTS_EDIT 99
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -386,6 +386,10 @@ union must_be_pod
}
// Required by CodeWarrior
+ must_be_pod()
+ {}
+
+ // Required by CodeWarrior
~must_be_pod() stlsoft_throw_0()
{
int (*pfn)(void) = constraints;
@@ -394,6 +398,12 @@ union must_be_pod
}
private:
+#if !defined(STLSOFT_COMPILER_IS_MWERKS)
+ must_be_pod(class_type const&);
+ class_type& operator =(class_type const&);
+#endif
+
+private:
static int constraints()
{
#if defined(STLSOFT_COMPILER_IS_MWERKS)
View
91 include/stlsoft/util/minmax.hpp
@@ -4,11 +4,11 @@
* Purpose: Definition of minimum() and maximum() template functions.
*
* Created: 11th April 2005
- * Updated: 10th August 2009
+ * Updated: 10th August 2010
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2005-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 2005-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,9 +50,9 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_UTIL_HPP_MINMAX_MAJOR 2
-# define STLSOFT_VER_STLSOFT_UTIL_HPP_MINMAX_MINOR 0
+# define STLSOFT_VER_STLSOFT_UTIL_HPP_MINMAX_MINOR 1
# define STLSOFT_VER_STLSOFT_UTIL_HPP_MINMAX_REVISION 1
-# define STLSOFT_VER_STLSOFT_UTIL_HPP_MINMAX_EDIT 14
+# define STLSOFT_VER_STLSOFT_UTIL_HPP_MINMAX_EDIT 15
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -100,6 +100,89 @@ inline T const& maximum(T const& lhs, T const& rhs)
return (lhs < rhs) ? rhs : lhs;
}
+
+#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
+
+template <
+ ss_typename_param_k T
+>
+inline T const& maximum(
+ T const& v0
+, T const& v1
+, T const& v2
+)
+{
+ return maximum(maximum(v0, v1), v2);
+}
+
+template <
+ ss_typename_param_k T
+>
+inline T const& minimum(
+ T const& v0
+, T const& v1
+, T const& v2
+)
+{
+ return minimum(minimum(v0, v1), v2);
+}
+
+template <
+ ss_typename_param_k T
+>
+inline T const& maximum(
+ T const& v0
+, T const& v1
+, T const& v2
+, T const& v3
+)
+{
+ return maximum(maximum(v0, v1), maximum(v2, v3));
+}
+
+template <
+ ss_typename_param_k T
+>
+inline T const& minimum(
+ T const& v0
+, T const& v1
+, T const& v2
+, T const& v3
+)
+{
+ return minimum(minimum(v0, v1), minimum(v2, v3));
+}
+
+template <
+ ss_typename_param_k T
+>
+inline T const& maximum(
+ T const& v0
+, T const& v1
+, T const& v2
+, T const& v3
+, T const& v4
+)
+{
+ return maximum(maximum(maximum(v0, v1), maximum(v2, v3)), v4);
+}
+
+template <
+ ss_typename_param_k T
+>
+inline T const& minimum(
+ T const& v0
+, T const& v1
+, T const& v2
+, T const& v3
+, T const& v4
+)
+{
+ return minimum(minimum(minimum(v0, v1), minimum(v2, v3)), v4);
+}
+
+#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
+
/* ////////////////////////////////////////////////////////////////////// */
#ifndef _STLSOFT_NO_NAMESPACE
View
8 include/stlsoft/util/std_swap.hpp
@@ -4,11 +4,11 @@
* Purpose: Contains the std_swap() function.
*
* Created: 27th June 2005
- * Updated: 10th August 2009
+ * Updated: 12th August 2010
*
* Home: http://stlsoft.org/
*
- * Copyright (c) 2005-2009, Matthew Wilson and Synesis Software
+ * Copyright (c) 2005-2010, Matthew Wilson and Synesis Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@
# define STLSOFT_VER_STLSOFT_UTIL_HPP_STD_SWAP_MAJOR 1
# define STLSOFT_VER_STLSOFT_UTIL_HPP_STD_SWAP_MINOR 2
# define STLSOFT_VER_STLSOFT_UTIL_HPP_STD_SWAP_REVISION 2
-# define STLSOFT_VER_STLSOFT_UTIL_HPP_STD_SWAP_EDIT 18
+# define STLSOFT_VER_STLSOFT_UTIL_HPP_STD_SWAP_EDIT 19
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -132,7 +132,7 @@ namespace stlsoft_nostd_util
template<ss_typename_param_k T>
inline void std_swap(T& lhs, T& rhs)
{
- // Here we introduce the 'std' implementation, via a using namespace 'std'
+ // Here we introduce the 'std' implementation, via a 'using namespace std'
// directive, so that Argument-Dependent Lookup can have the best grab
#ifdef STLSOFT_STD_SWAP_NO_USE_STD
View
40 include/unixstl/dl/module.hpp
@@ -4,7 +4,7 @@
* Purpose: Contains the module class.
*
* Created: 30th October 1997
- * Updated: 30th March 2010
+ * Updated: 12th August 2010
*
* Home: http://stlsoft.org/
*
@@ -49,9 +49,9 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_MAJOR 6
-# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_MINOR 2
-# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_REVISION 5
-# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_EDIT 218
+# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_MINOR 3
+# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_REVISION 1
+# define UNIXSTL_VER_UNIXSTL_DL_HPP_MODULE_EDIT 220
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -71,6 +71,9 @@
#ifndef UNIXSTL_INCL_UNIXSTL_HPP_ERROR_UNIX_EXCEPTIONS
# include <unixstl/error/exceptions.hpp>
#endif /* !UNIXSTL_INCL_UNIXSTL_ERROR_HPP_UNIX_EXCEPTIONS */
+#ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
+# include <stlsoft/shims/access/string.hpp>
+#endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
#ifndef UNIXSTL_INCL_UNIXSTL_SHIMS_ACCESS_HPP_STRING
# include <unixstl/shims/access/string.hpp>
#endif /* !UNIXSTL_INCL_UNIXSTL_SHIMS_ACCESS_HPP_STRING */
@@ -119,10 +122,17 @@ class module
public:
/// \brief The handle type
typedef void* module_handle_type;
+ /// \brief The handle type
+ ///
+ /// \note This member type is required to make it compatible with
+ /// the STLSoft get_module_handle access shim
+ typedef void* handle_type;
/// \brief The class type
typedef module class_type;
/// \brief The entry point type
typedef void* proc_pointer_type;
+public:
+ typedef handle_type resource_type;
/// \name Construction
/// @{
@@ -145,6 +155,7 @@ class module
/// \link unixstl::unix_exception unix_exception\endlink
/// if the module cannot be loaded
ss_explicit_k module(us_char_w_t const* moduleName, int mode = RTLD_NOW);
+#if defined(STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT)
/// \brief Constructs by loading the named module
///
/// \param moduleName The file name of the executable module to be
@@ -160,13 +171,14 @@ class module
ss_explicit_k module(S const& moduleName, int mode = RTLD_NOW)
: m_hmodule(load(moduleName, mode))
{
-#ifdef STLSOFT_CF_EXCEPTION_SUPPORT
+# ifdef STLSOFT_CF_EXCEPTION_SUPPORT
if(NULL == m_hmodule)
{
STLSOFT_THROW_X(unix_exception("Cannot load module", errno));
}
-#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
+# endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
}
+#endif /* STLSOFT_CF_MEMBER_TEMPLATE_CTOR_SUPPORT */
/// \brief Constructs by taking ownership of the given handle
///
/// \note If exception-handling is being used, then this throws a
@@ -196,6 +208,7 @@ class module
///