//
// detail/config.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under 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)
//

#ifndef NET_TS_DETAIL_CONFIG_HPP
#define NET_TS_DETAIL_CONFIG_HPP

#define NET_TS_STANDALONE 1

#if defined(NET_TS_STANDALONE)
# define NET_TS_DISABLE_BOOST_ARRAY 1
# define NET_TS_DISABLE_BOOST_ASSERT 1
# define NET_TS_DISABLE_BOOST_BIND 1
# define NET_TS_DISABLE_BOOST_CHRONO 1
# define NET_TS_DISABLE_BOOST_DATE_TIME 1
# define NET_TS_DISABLE_BOOST_LIMITS 1
# define NET_TS_DISABLE_BOOST_REGEX 1
# define NET_TS_DISABLE_BOOST_STATIC_CONSTANT 1
# define NET_TS_DISABLE_BOOST_THROW_EXCEPTION 1
# define NET_TS_DISABLE_BOOST_WORKAROUND 1
#else // defined(NET_TS_STANDALONE)
# include <boost/config.hpp>
# include <boost/version.hpp>
# define NET_TS_HAS_BOOST_CONFIG 1
#endif // defined(NET_TS_STANDALONE)

// Default to a header-only implementation. The user must specifically request
// separate compilation by defining either NET_TS_SEPARATE_COMPILATION or
// NET_TS_DYN_LINK (as a DLL/shared library implies separate compilation).
#if !defined(NET_TS_HEADER_ONLY)
# if !defined(NET_TS_SEPARATE_COMPILATION)
#  if !defined(NET_TS_DYN_LINK)
#   define NET_TS_HEADER_ONLY 1
#  endif // !defined(NET_TS_DYN_LINK)
# endif // !defined(NET_TS_SEPARATE_COMPILATION)
#endif // !defined(NET_TS_HEADER_ONLY)

#if defined(NET_TS_HEADER_ONLY)
# define NET_TS_DECL inline
#else // defined(NET_TS_HEADER_ONLY)
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
// We need to import/export our code only if the user has specifically asked
// for it by defining NET_TS_DYN_LINK.
#  if defined(NET_TS_DYN_LINK)
// Export if this is our own source, otherwise import.
#   if defined(NET_TS_SOURCE)
#    define NET_TS_DECL __declspec(dllexport)
#   else // defined(NET_TS_SOURCE)
#    define NET_TS_DECL __declspec(dllimport)
#   endif // defined(NET_TS_SOURCE)
#  endif // defined(NET_TS_DYN_LINK)
# endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
#endif // defined(NET_TS_HEADER_ONLY)

// If NET_TS_DECL isn't defined yet define it now.
#if !defined(NET_TS_DECL)
# define NET_TS_DECL
#endif // !defined(NET_TS_DECL)

// Microsoft Visual C++ detection.
#if !defined(NET_TS_MSVC)
# if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
#  define NET_TS_MSVC BOOST_MSVC
# elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
      || (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
#  define NET_TS_MSVC _MSC_VER
# endif // defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
#endif // !defined(NET_TS_MSVC)

// Clang / libc++ detection.
#if defined(__clang__)
# if (__cplusplus >= 201103)
#  if __has_include(<__config>)
#   include <__config>
#   if defined(_LIBCPP_VERSION)
#    define NET_TS_HAS_CLANG_LIBCXX 1
#   endif // defined(_LIBCPP_VERSION)
#  endif // __has_include(<__config>)
# endif // (__cplusplus >= 201103)
#endif // defined(__clang__)

// Android platform detection.
#if defined(__ANDROID__)
# include <android/api-level.h>
#endif // defined(__ANDROID__)

// Support move construction and assignment on compilers known to allow it.
#if !defined(NET_TS_HAS_MOVE)
# if !defined(NET_TS_DISABLE_MOVE)
#  if defined(__clang__)
#   if __has_feature(__cxx_rvalue_references__)
#    define NET_TS_HAS_MOVE 1
#   endif // __has_feature(__cxx_rvalue_references__)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_MOVE 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_MOVE 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
#  if defined(__INTEL_CXX11_MODE__)
#    if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
#      define BOOST_NET_TS_HAS_MOVE 1
#    endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
#    if defined(__ICL) && (__ICL >= 1500)
#      define BOOST_NET_TS_HAS_MOVE 1
#    endif // defined(__ICL) && (__ICL >= 1500)
#  endif // defined(__INTEL_CXX11_MODE__)
# endif // !defined(NET_TS_DISABLE_MOVE)
#endif // !defined(NET_TS_HAS_MOVE)

// If NET_TS_MOVE_CAST isn't defined, and move support is available, define
// NET_TS_MOVE_ARG and NET_TS_MOVE_CAST to take advantage of rvalue
// references and perfect forwarding.
#if defined(NET_TS_HAS_MOVE) && !defined(NET_TS_MOVE_CAST)
# define NET_TS_MOVE_ARG(type) type&&
# define NET_TS_MOVE_ARG2(type1, type2) type1, type2&&
# define NET_TS_MOVE_CAST(type) static_cast<type&&>
# define NET_TS_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
#endif // defined(NET_TS_HAS_MOVE) && !defined(NET_TS_MOVE_CAST)

// If NET_TS_MOVE_CAST still isn't defined, default to a C++03-compatible
// implementation. Note that older g++ and MSVC versions don't like it when you
// pass a non-member function through a const reference, so for most compilers
// we'll play it safe and stick with the old approach of passing the handler by
// value.
#if !defined(NET_TS_MOVE_CAST)
# if defined(__GNUC__)
#  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
#   define NET_TS_MOVE_ARG(type) const type&
#  else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
#   define NET_TS_MOVE_ARG(type) type
#  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
# elif defined(NET_TS_MSVC)
#  if (_MSC_VER >= 1400)
#   define NET_TS_MOVE_ARG(type) const type&
#  else // (_MSC_VER >= 1400)
#   define NET_TS_MOVE_ARG(type) type
#  endif // (_MSC_VER >= 1400)
# else
#  define NET_TS_MOVE_ARG(type) type
# endif
# define NET_TS_MOVE_CAST(type) static_cast<const type&>
# define NET_TS_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
#endif // !defined(NET_TS_MOVE_CAST)

// Support variadic templates on compilers known to allow it.
#if !defined(NET_TS_HAS_VARIADIC_TEMPLATES)
# if !defined(NET_TS_DISABLE_VARIADIC_TEMPLATES)
#  if defined(__clang__)
#   if __has_feature(__cxx_variadic_templates__)
#    define NET_TS_HAS_VARIADIC_TEMPLATES 1
#   endif // __has_feature(__cxx_variadic_templates__)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_VARIADIC_TEMPLATES 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1900)
#    define NET_TS_HAS_VARIADIC_TEMPLATES 1
#   endif // (_MSC_VER >= 1900)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_VARIADIC_TEMPLATES)
#endif // !defined(NET_TS_HAS_VARIADIC_TEMPLATES)

// Support deleted functions on compilers known to allow it.
#if !defined(NET_TS_DELETED)
# if defined(__GNUC__)
#  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#   if defined(__GXX_EXPERIMENTAL_CXX0X__)
#    define NET_TS_DELETED = delete
#   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
# if defined(__clang__)
#  if __has_feature(__cxx_deleted_functions__)
#   define NET_TS_DELETED = delete
#  endif // __has_feature(__cxx_deleted_functions__)
# endif // defined(__clang__)
# if defined(NET_TS_MSVC)
#  if (_MSC_VER >= 1900)
#   define NET_TS_DELETED = delete
#  endif // (_MSC_VER >= 1900)
# endif // defined(NET_TS_MSVC)
# if !defined(NET_TS_DELETED)
#  define NET_TS_DELETED
# endif // !defined(NET_TS_DELETED)
#endif // !defined(NET_TS_DELETED)

// Support constexpr on compilers known to allow it.
#if !defined(NET_TS_HAS_CONSTEXPR)
# if !defined(NET_TS_DISABLE_CONSTEXPR)
#  if defined(__clang__)
#   if __has_feature(__cxx_constexpr__)
#    define NET_TS_HAS_CONSTEXPR 1
#   endif // __has_feature(__cxx_constexr__)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_CONSTEXPR 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1900)
#    define NET_TS_HAS_CONSTEXPR 1
#   endif // (_MSC_VER >= 1900)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_CONSTEXPR)
#endif // !defined(NET_TS_HAS_CONSTEXPR)
#if !defined(NET_TS_CONSTEXPR)
# if defined(NET_TS_HAS_CONSTEXPR)
#  define NET_TS_CONSTEXPR constexpr
# else // defined(NET_TS_HAS_CONSTEXPR)
#  define NET_TS_CONSTEXPR
# endif // defined(NET_TS_HAS_CONSTEXPR)
#endif // !defined(NET_TS_CONSTEXPR)

// Support noexcept on compilers known to allow it.
#if !defined(NET_TS_NOEXCEPT)
# if !defined(NET_TS_DISABLE_NOEXCEPT)
#  if defined(NET_TS_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
#   define NET_TS_NOEXCEPT BOOST_NOEXCEPT
#   define NET_TS_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
#  elif defined(__clang__)
#   if __has_feature(__cxx_noexcept__)
#    define NET_TS_NOEXCEPT noexcept(true)
#    define NET_TS_NOEXCEPT_OR_NOTHROW noexcept(true)
#   endif // __has_feature(__cxx_noexcept__)
#  elif defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#      define NET_TS_NOEXCEPT noexcept(true)
#      define NET_TS_NOEXCEPT_OR_NOTHROW noexcept(true)
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  elif defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1900)
#    define NET_TS_NOEXCEPT noexcept(true)
#    define NET_TS_NOEXCEPT_OR_NOTHROW noexcept(true)
#   endif // (_MSC_VER >= 1900)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_NOEXCEPT)
# if !defined(NET_TS_NOEXCEPT)
#  define NET_TS_NOEXCEPT
# endif // !defined(NET_TS_NOEXCEPT)
# if !defined(NET_TS_NOEXCEPT_OR_NOTHROW)
#  define NET_TS_NOEXCEPT_OR_NOTHROW throw()
# endif // !defined(NET_TS_NOEXCEPT_OR_NOTHROW)
#endif // !defined(NET_TS_NOEXCEPT)

// Support automatic type deduction on compilers known to support it.
#if !defined(NET_TS_HAS_DECLTYPE)
# if !defined(NET_TS_DISABLE_DECLTYPE)
#  if defined(__clang__)
#   if __has_feature(__cxx_decltype__)
#    define NET_TS_HAS_DECLTYPE 1
#   endif // __has_feature(__cxx_decltype__)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_DECLTYPE 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_DECLTYPE 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_DECLTYPE)
#endif // !defined(NET_TS_HAS_DECLTYPE)

// Support alias templates on compilers known to allow it.
#if !defined(NET_TS_HAS_ALIAS_TEMPLATES)
# if !defined(NET_TS_DISABLE_ALIAS_TEMPLATES)
#  if defined(__clang__)
#   if __has_feature(__cxx_alias_templates__)
#    define NET_TS_HAS_ALIAS_TEMPLATES 1
#   endif // __has_feature(__cxx_alias_templates__)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_ALIAS_TEMPLATES 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1900)
#    define NET_TS_HAS_ALIAS_TEMPLATES 1
#   endif // (_MSC_VER >= 1900)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_ALIAS_TEMPLATES)
#endif // !defined(NET_TS_HAS_ALIAS_TEMPLATES)

// Standard library support for system errors.
#if !defined(NET_TS_HAS_STD_SYSTEM_ERROR)
# if !defined(NET_TS_DISABLE_STD_SYSTEM_ERROR)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_SYSTEM_ERROR 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<system_error>)
#     define NET_TS_HAS_STD_SYSTEM_ERROR 1
#    endif // __has_include(<system_error>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_SYSTEM_ERROR 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_SYSTEM_ERROR 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_SYSTEM_ERROR)
#endif // !defined(NET_TS_HAS_STD_SYSTEM_ERROR)

// Compliant C++11 compilers put noexcept specifiers on error_category members.
#if !defined(NET_TS_ERROR_CATEGORY_NOEXCEPT)
# if (BOOST_VERSION >= 105300)
#  define NET_TS_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
# elif defined(__clang__)
#  if __has_feature(__cxx_noexcept__)
#   define NET_TS_ERROR_CATEGORY_NOEXCEPT noexcept(true)
#  endif // __has_feature(__cxx_noexcept__)
# elif defined(__GNUC__)
#  if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#   if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_ERROR_CATEGORY_NOEXCEPT noexcept(true)
#   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# elif defined(NET_TS_MSVC)
#  if (_MSC_VER >= 1900)
#   define NET_TS_ERROR_CATEGORY_NOEXCEPT noexcept(true)
#  endif // (_MSC_VER >= 1900)
# endif // defined(NET_TS_MSVC)
# if !defined(NET_TS_ERROR_CATEGORY_NOEXCEPT)
#  define NET_TS_ERROR_CATEGORY_NOEXCEPT
# endif // !defined(NET_TS_ERROR_CATEGORY_NOEXCEPT)
#endif // !defined(NET_TS_ERROR_CATEGORY_NOEXCEPT)

// Standard library support for arrays.
#if !defined(NET_TS_HAS_STD_ARRAY)
# if !defined(NET_TS_DISABLE_STD_ARRAY)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_ARRAY 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<array>)
#     define NET_TS_HAS_STD_ARRAY 1
#    endif // __has_include(<array>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_ARRAY 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1600)
#    define NET_TS_HAS_STD_ARRAY 1
#   endif // (_MSC_VER >= 1600)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_ARRAY)
#endif // !defined(NET_TS_HAS_STD_ARRAY)

// Standard library support for shared_ptr and weak_ptr.
#if !defined(NET_TS_HAS_STD_SHARED_PTR)
# if !defined(NET_TS_DISABLE_STD_SHARED_PTR)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_SHARED_PTR 1
#   elif (__cplusplus >= 201103)
#    define NET_TS_HAS_STD_SHARED_PTR 1
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_SHARED_PTR 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1600)
#    define NET_TS_HAS_STD_SHARED_PTR 1
#   endif // (_MSC_VER >= 1600)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_SHARED_PTR)
#endif // !defined(NET_TS_HAS_STD_SHARED_PTR)

// Standard library support for allocator_arg_t.
#if !defined(NET_TS_HAS_STD_ALLOCATOR_ARG)
# if !defined(NET_TS_DISABLE_STD_ALLOCATOR_ARG)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_ALLOCATOR_ARG 1
#   elif (__cplusplus >= 201103)
#    define NET_TS_HAS_STD_ALLOCATOR_ARG 1
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_ALLOCATOR_ARG 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1600)
#    define NET_TS_HAS_STD_ALLOCATOR_ARG 1
#   endif // (_MSC_VER >= 1600)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_ALLOCATOR_ARG)
#endif // !defined(NET_TS_HAS_STD_ALLOCATOR_ARG)

// Standard library support for atomic operations.
#if !defined(NET_TS_HAS_STD_ATOMIC)
# if !defined(NET_TS_DISABLE_STD_ATOMIC)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_ATOMIC 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<atomic>)
#     define NET_TS_HAS_STD_ATOMIC 1
#    endif // __has_include(<atomic>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_ATOMIC 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_ATOMIC 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_ATOMIC)
#endif // !defined(NET_TS_HAS_STD_ATOMIC)

// Standard library support for chrono. Some standard libraries (such as the
// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
// drafts, rather than the eventually standardised name of steady_clock.
#if !defined(NET_TS_HAS_STD_CHRONO)
# if !defined(NET_TS_DISABLE_STD_CHRONO)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_CHRONO 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<chrono>)
#     define NET_TS_HAS_STD_CHRONO 1
#    endif // __has_include(<chrono>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_CHRONO 1
#     if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
#      define NET_TS_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
#     endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_CHRONO 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_CHRONO)
#endif // !defined(NET_TS_HAS_STD_CHRONO)

// Boost support for chrono.
#if !defined(NET_TS_HAS_BOOST_CHRONO)
# if !defined(NET_TS_DISABLE_BOOST_CHRONO)
#  if (BOOST_VERSION >= 104700)
#   define NET_TS_HAS_BOOST_CHRONO 1
#  endif // (BOOST_VERSION >= 104700)
# endif // !defined(NET_TS_DISABLE_BOOST_CHRONO)
#endif // !defined(NET_TS_HAS_BOOST_CHRONO)

// Some form of chrono library is available.
#if !defined(NET_TS_HAS_CHRONO)
# if defined(NET_TS_HAS_STD_CHRONO) \
    || defined(NET_TS_HAS_BOOST_CHRONO)
#  define NET_TS_HAS_CHRONO 1
# endif // defined(NET_TS_HAS_STD_CHRONO)
        // || defined(NET_TS_HAS_BOOST_CHRONO)
#endif // !defined(NET_TS_HAS_CHRONO)

// Boost support for the DateTime library.
#if !defined(NET_TS_HAS_BOOST_DATE_TIME)
# if !defined(NET_TS_DISABLE_BOOST_DATE_TIME)
#  define NET_TS_HAS_BOOST_DATE_TIME 1
# endif // !defined(NET_TS_DISABLE_BOOST_DATE_TIME)
#endif // !defined(NET_TS_HAS_BOOST_DATE_TIME)

// Standard library support for addressof.
#if !defined(NET_TS_HAS_STD_ADDRESSOF)
# if !defined(NET_TS_DISABLE_STD_ADDRESSOF)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_ADDRESSOF 1
#   elif (__cplusplus >= 201103)
#    define NET_TS_HAS_STD_ADDRESSOF 1
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_ADDRESSOF 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_ADDRESSOF 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_ADDRESSOF)
#endif // !defined(NET_TS_HAS_STD_ADDRESSOF)

// Standard library support for the function class.
#if !defined(NET_TS_HAS_STD_FUNCTION)
# if !defined(NET_TS_DISABLE_STD_FUNCTION)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_FUNCTION 1
#   elif (__cplusplus >= 201103)
#    define NET_TS_HAS_STD_FUNCTION 1
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_FUNCTION 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_FUNCTION 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_FUNCTION)
#endif // !defined(NET_TS_HAS_STD_FUNCTION)

// Standard library support for type traits.
#if !defined(NET_TS_HAS_STD_TYPE_TRAITS)
# if !defined(NET_TS_DISABLE_STD_TYPE_TRAITS)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_TYPE_TRAITS 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<type_traits>)
#     define NET_TS_HAS_STD_TYPE_TRAITS 1
#    endif // __has_include(<type_traits>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_TYPE_TRAITS 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_TYPE_TRAITS 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_TYPE_TRAITS)
#endif // !defined(NET_TS_HAS_STD_TYPE_TRAITS)

// Standard library support for the nullptr_t type.
#if !defined(NET_TS_HAS_NULLPTR)
# if !defined(NET_TS_DISABLE_NULLPTR)
#  if defined(__clang__)
#   if __has_feature(__cxx_nullptr__)
#    define NET_TS_HAS_NULLPTR 1
#   endif // __has_feature(__cxx_rvalue_references__)
#  elif defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_NULLPTR 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_NULLPTR 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_NULLPTR)
#endif // !defined(NET_TS_HAS_NULLPTR)

// Standard library support for the C++11 allocator additions.
#if !defined(NET_TS_HAS_CXX11_ALLOCATORS)
# if !defined(NET_TS_DISABLE_CXX11_ALLOCATORS)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_CXX11_ALLOCATORS 1
#   elif (__cplusplus >= 201103)
#    define NET_TS_HAS_CXX11_ALLOCATORS 1
#   endif // (__cplusplus >= 201103)
#  elif defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_CXX11_ALLOCATORS 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1800)
#    define NET_TS_HAS_CXX11_ALLOCATORS 1
#   endif // (_MSC_VER >= 1800)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_CXX11_ALLOCATORS)
#endif // !defined(NET_TS_HAS_CXX11_ALLOCATORS)

// Standard library support for the cstdint header.
#if !defined(NET_TS_HAS_CSTDINT)
# if !defined(NET_TS_DISABLE_CSTDINT)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_CSTDINT 1
#   elif (__cplusplus >= 201103)
#    define NET_TS_HAS_CSTDINT 1
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_CSTDINT 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_CSTDINT 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_CSTDINT)
#endif // !defined(NET_TS_HAS_CSTDINT)

// Standard library support for the thread class.
#if !defined(NET_TS_HAS_STD_THREAD)
# if !defined(NET_TS_DISABLE_STD_THREAD)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_THREAD 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<thread>)
#     define NET_TS_HAS_STD_THREAD 1
#    endif // __has_include(<thread>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_THREAD 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_THREAD 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_THREAD)
#endif // !defined(NET_TS_HAS_STD_THREAD)

// Standard library support for the mutex and condition variable classes.
#if !defined(NET_TS_HAS_STD_MUTEX_AND_CONDVAR)
# if !defined(NET_TS_DISABLE_STD_MUTEX_AND_CONDVAR)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_MUTEX_AND_CONDVAR 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<mutex>)
#     define NET_TS_HAS_STD_MUTEX_AND_CONDVAR 1
#    endif // __has_include(<mutex>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_MUTEX_AND_CONDVAR 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_MUTEX_AND_CONDVAR 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_MUTEX_AND_CONDVAR)
#endif // !defined(NET_TS_HAS_STD_MUTEX_AND_CONDVAR)

// Standard library support for the call_once function.
#if !defined(NET_TS_HAS_STD_CALL_ONCE)
# if !defined(NET_TS_DISABLE_STD_CALL_ONCE)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_CALL_ONCE 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<mutex>)
#     define NET_TS_HAS_STD_CALL_ONCE 1
#    endif // __has_include(<mutex>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_CALL_ONCE 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_CALL_ONCE 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_CALL_ONCE)
#endif // !defined(NET_TS_HAS_STD_CALL_ONCE)

// Standard library support for futures.
#if !defined(NET_TS_HAS_STD_FUTURE)
# if !defined(NET_TS_DISABLE_STD_FUTURE)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    define NET_TS_HAS_STD_FUTURE 1
#   elif (__cplusplus >= 201103)
#    if __has_include(<future>)
#     define NET_TS_HAS_STD_FUTURE 1
#    endif // __has_include(<mutex>)
#   endif // (__cplusplus >= 201103)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_FUTURE 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_FUTURE 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_FUTURE)
#endif // !defined(NET_TS_HAS_STD_FUTURE)

// Standard library support for std::string_view.
#if !defined(NET_TS_HAS_STD_STRING_VIEW)
# if !defined(NET_TS_DISABLE_STD_STRING_VIEW)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    if (__cplusplus >= 201402)
#     if __has_include(<string_view>)
#      define NET_TS_HAS_STD_STRING_VIEW 1
#     endif // __has_include(<string_view>)
#    endif // (__cplusplus >= 201402)
#   else // defined(NET_TS_HAS_CLANG_LIBCXX)
#    if (__cplusplus >= 201703)
#     if __has_include(<string_view>)
#      define NET_TS_HAS_STD_STRING_VIEW 1
#     endif // __has_include(<string_view>)
#    endif // (__cplusplus >= 201703)
#   endif // defined(NET_TS_HAS_CLANG_LIBCXX)
#  elif defined(__GNUC__)
#   if (__GNUC__ >= 7)
#    if (__cplusplus >= 201703)
#     define NET_TS_HAS_STD_STRING_VIEW 1
#    endif // (__cplusplus >= 201703)
#   endif // (__GNUC__ >= 7)
#  elif defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
#    define NET_TS_HAS_STD_STRING_VIEW 1
#   endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_STRING_VIEW)
#endif // !defined(NET_TS_HAS_STD_STRING_VIEW)

// Standard library support for std::experimental::string_view.
#if !defined(NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW)
# if !defined(NET_TS_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
#  if defined(__clang__)
#   if defined(NET_TS_HAS_CLANG_LIBCXX)
#    if (_LIBCPP_VERSION < 7000)
#     if (__cplusplus >= 201402)
#      if __has_include(<experimental/string_view>)
#       define NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
#      endif // __has_include(<experimental/string_view>)
#     endif // (__cplusplus >= 201402)
#    endif // (_LIBCPP_VERSION < 7000)
#   else // defined(NET_TS_HAS_CLANG_LIBCXX)
#    if (__cplusplus >= 201402)
#     if __has_include(<experimental/string_view>)
#      define NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
#     endif // __has_include(<experimental/string_view>)
#    endif // (__cplusplus >= 201402)
#   endif // // defined(NET_TS_HAS_CLANG_LIBCXX)
#  endif // defined(__clang__)
#  if defined(__GNUC__)
#   if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
#    if (__cplusplus >= 201402)
#     define NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
#    endif // (__cplusplus >= 201402)
#   endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
#  endif // defined(__GNUC__)
# endif // !defined(NET_TS_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
#endif // !defined(NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW)

// Standard library has a string_view that we can use.
#if !defined(NET_TS_HAS_STRING_VIEW)
# if !defined(NET_TS_DISABLE_STRING_VIEW)
#  if defined(NET_TS_HAS_STD_STRING_VIEW)
#   define NET_TS_HAS_STRING_VIEW 1
#  elif defined(NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW)
#   define NET_TS_HAS_STRING_VIEW 1
#  endif // defined(NET_TS_HAS_STD_EXPERIMENTAL_STRING_VIEW)
# endif // !defined(NET_TS_DISABLE_STRING_VIEW)
#endif // !defined(NET_TS_HAS_STRING_VIEW)

// Standard library support for iostream move construction and assignment.
#if !defined(NET_TS_HAS_STD_IOSTREAM_MOVE)
# if !defined(NET_TS_DISABLE_STD_IOSTREAM_MOVE)
#  if defined(__GNUC__)
#   if (__GNUC__ > 4)
#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
#     define NET_TS_HAS_STD_IOSTREAM_MOVE 1
#    endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
#   endif // (__GNUC__ > 4)
#  endif // defined(__GNUC__)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1700)
#    define NET_TS_HAS_STD_IOSTREAM_MOVE 1
#   endif // (_MSC_VER >= 1700)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_IOSTREAM_MOVE)
#endif // !defined(NET_TS_HAS_STD_IOSTREAM_MOVE)

// Standard library has invoke_result (which supersedes result_of).
#if !defined(NET_TS_HAS_STD_INVOKE_RESULT)
# if !defined(NET_TS_DISABLE_STD_INVOKE_RESULT)
#  if defined(NET_TS_MSVC)
#   if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
#    define NET_TS_HAS_STD_INVOKE_RESULT 1
#   endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_STD_INVOKE_RESULT)
#endif // !defined(NET_TS_HAS_STD_INVOKE_RESULT)

// Windows App target. Windows but with a limited API.
#if !defined(NET_TS_WINDOWS_APP)
# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
#  include <winapifamily.h>
#  if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
   && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#   define NET_TS_WINDOWS_APP 1
#  endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
         // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
#endif // !defined(NET_TS_WINDOWS_APP)

// Legacy WinRT target. Windows App is preferred.
#if !defined(NET_TS_WINDOWS_RUNTIME)
# if !defined(NET_TS_WINDOWS_APP)
#  if defined(__cplusplus_winrt)
#   include <winapifamily.h>
#   if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
    && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#    define NET_TS_WINDOWS_RUNTIME 1
#   endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
          // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#  endif // defined(__cplusplus_winrt)
# endif // !defined(NET_TS_WINDOWS_APP)
#endif // !defined(NET_TS_WINDOWS_RUNTIME)

// Windows target. Excludes WinRT but includes Windows App targets.
#if !defined(NET_TS_WINDOWS)
# if !defined(NET_TS_WINDOWS_RUNTIME)
#  if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
#   define NET_TS_WINDOWS 1
#  elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#   define NET_TS_WINDOWS 1
#  elif defined(NET_TS_WINDOWS_APP)
#   define NET_TS_WINDOWS 1
#  endif // defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
# endif // !defined(NET_TS_WINDOWS_RUNTIME)
#endif // !defined(NET_TS_WINDOWS)

// Windows: target OS version.
#if defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
# if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
#  if defined(_MSC_VER) || defined(__BORLANDC__)
#   pragma message( \
  "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
  "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\
  "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\
  "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).")
#  else // defined(_MSC_VER) || defined(__BORLANDC__)
#   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
#   warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
#   warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
#  endif // defined(_MSC_VER) || defined(__BORLANDC__)
#  define _WIN32_WINNT 0x0501
# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
# if defined(_MSC_VER)
#  if defined(_WIN32) && !defined(WIN32)
#   if !defined(_WINSOCK2API_)
#    define WIN32 // Needed for correct types in winsock2.h
#   else // !defined(_WINSOCK2API_)
#    error Please define the macro WIN32 in your compiler options
#   endif // !defined(_WINSOCK2API_)
#  endif // defined(_WIN32) && !defined(WIN32)
# endif // defined(_MSC_VER)
# if defined(__BORLANDC__)
#  if defined(__WIN32__) && !defined(WIN32)
#   if !defined(_WINSOCK2API_)
#    define WIN32 // Needed for correct types in winsock2.h
#   else // !defined(_WINSOCK2API_)
#    error Please define the macro WIN32 in your compiler options
#   endif // !defined(_WINSOCK2API_)
#  endif // defined(__WIN32__) && !defined(WIN32)
# endif // defined(__BORLANDC__)
# if defined(__CYGWIN__)
#  if !defined(__USE_W32_SOCKETS)
#   error You must add -D__USE_W32_SOCKETS to your compiler options.
#  endif // !defined(__USE_W32_SOCKETS)
# endif // defined(__CYGWIN__)
#endif // defined(NET_TS_WINDOWS) || defined(__CYGWIN__)

// Windows: minimise header inclusion.
#if defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
# if !defined(NET_TS_NO_WIN32_LEAN_AND_MEAN)
#  if !defined(WIN32_LEAN_AND_MEAN)
#   define WIN32_LEAN_AND_MEAN
#  endif // !defined(WIN32_LEAN_AND_MEAN)
# endif // !defined(NET_TS_NO_WIN32_LEAN_AND_MEAN)
#endif // defined(NET_TS_WINDOWS) || defined(__CYGWIN__)

// Windows: suppress definition of "min" and "max" macros.
#if defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
# if !defined(NET_TS_NO_NOMINMAX)
#  if !defined(NOMINMAX)
#   define NOMINMAX 1
#  endif // !defined(NOMINMAX)
# endif // !defined(NET_TS_NO_NOMINMAX)
#endif // defined(NET_TS_WINDOWS) || defined(__CYGWIN__)

// Windows: IO Completion Ports.
#if !defined(NET_TS_HAS_IOCP)
# if defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
#  if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
#   if !defined(UNDER_CE) && !defined(NET_TS_WINDOWS_APP)
#    if !defined(NET_TS_DISABLE_IOCP)
#     define NET_TS_HAS_IOCP 1
#    endif // !defined(NET_TS_DISABLE_IOCP)
#   endif // !defined(UNDER_CE) && !defined(NET_TS_WINDOWS_APP)
#  endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
# endif // defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
#endif // !defined(NET_TS_HAS_IOCP)

// On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
// get access to the various platform feature macros, e.g. to be able to test
// for threads support.
#if !defined(NET_TS_HAS_UNISTD_H)
# if !defined(NET_TS_HAS_BOOST_CONFIG)
#  if defined(unix) \
   || defined(__unix) \
   || defined(_XOPEN_SOURCE) \
   || defined(_POSIX_SOURCE) \
   || (defined(__MACH__) && defined(__APPLE__)) \
   || defined(__FreeBSD__) \
   || defined(__NetBSD__) \
   || defined(__OpenBSD__) \
   || defined(__linux__)
#   define NET_TS_HAS_UNISTD_H 1
#  endif
# endif // !defined(NET_TS_HAS_BOOST_CONFIG)
#endif // !defined(NET_TS_HAS_UNISTD_H)
#if defined(NET_TS_HAS_UNISTD_H)
# include <unistd.h>
#endif // defined(NET_TS_HAS_UNISTD_H)

// Linux: epoll, eventfd and timerfd.
#if defined(__linux__)
# include <linux/version.h>
# if !defined(NET_TS_HAS_EPOLL)
#  if !defined(NET_TS_DISABLE_EPOLL)
#   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
#    define NET_TS_HAS_EPOLL 1
#   endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
#  endif // !defined(NET_TS_DISABLE_EPOLL)
# endif // !defined(NET_TS_HAS_EPOLL)
# if !defined(NET_TS_HAS_EVENTFD)
#  if !defined(NET_TS_DISABLE_EVENTFD)
#   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
#    define NET_TS_HAS_EVENTFD 1
#   endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
#  endif // !defined(NET_TS_DISABLE_EVENTFD)
# endif // !defined(NET_TS_HAS_EVENTFD)
# if !defined(NET_TS_HAS_TIMERFD)
#  if defined(NET_TS_HAS_EPOLL)
#   if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
#    define NET_TS_HAS_TIMERFD 1
#   endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
#  endif // defined(NET_TS_HAS_EPOLL)
# endif // !defined(NET_TS_HAS_TIMERFD)
#endif // defined(__linux__)

// Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
#if (defined(__MACH__) && defined(__APPLE__)) \
  || defined(__FreeBSD__) \
  || defined(__NetBSD__) \
  || defined(__OpenBSD__)
# if !defined(NET_TS_HAS_KQUEUE)
#  if !defined(NET_TS_DISABLE_KQUEUE)
#   define NET_TS_HAS_KQUEUE 1
#  endif // !defined(NET_TS_DISABLE_KQUEUE)
# endif // !defined(NET_TS_HAS_KQUEUE)
#endif // (defined(__MACH__) && defined(__APPLE__))
       //   || defined(__FreeBSD__)
       //   || defined(__NetBSD__)
       //   || defined(__OpenBSD__)

// Solaris: /dev/poll.
#if defined(__sun)
# if !defined(NET_TS_HAS_DEV_POLL)
#  if !defined(NET_TS_DISABLE_DEV_POLL)
#   define NET_TS_HAS_DEV_POLL 1
#  endif // !defined(NET_TS_DISABLE_DEV_POLL)
# endif // !defined(NET_TS_HAS_DEV_POLL)
#endif // defined(__sun)

// Serial ports.
#if !defined(NET_TS_HAS_SERIAL_PORT)
# if defined(NET_TS_HAS_IOCP) \
  || !defined(NET_TS_WINDOWS) \
  && !defined(NET_TS_WINDOWS_RUNTIME) \
  && !defined(__CYGWIN__)
#  if !defined(__SYMBIAN32__)
#   if !defined(NET_TS_DISABLE_SERIAL_PORT)
#    define NET_TS_HAS_SERIAL_PORT 1
#   endif // !defined(NET_TS_DISABLE_SERIAL_PORT)
#  endif // !defined(__SYMBIAN32__)
# endif // defined(NET_TS_HAS_IOCP)
        //   || !defined(NET_TS_WINDOWS)
        //   && !defined(NET_TS_WINDOWS_RUNTIME)
        //   && !defined(__CYGWIN__)
#endif // !defined(NET_TS_HAS_SERIAL_PORT)

// Windows: stream handles.
#if !defined(NET_TS_HAS_WINDOWS_STREAM_HANDLE)
# if !defined(NET_TS_DISABLE_WINDOWS_STREAM_HANDLE)
#  if defined(NET_TS_HAS_IOCP)
#   define NET_TS_HAS_WINDOWS_STREAM_HANDLE 1
#  endif // defined(NET_TS_HAS_IOCP)
# endif // !defined(NET_TS_DISABLE_WINDOWS_STREAM_HANDLE)
#endif // !defined(NET_TS_HAS_WINDOWS_STREAM_HANDLE)

// Windows: random access handles.
#if !defined(NET_TS_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
# if !defined(NET_TS_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
#  if defined(NET_TS_HAS_IOCP)
#   define NET_TS_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
#  endif // defined(NET_TS_HAS_IOCP)
# endif // !defined(NET_TS_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
#endif // !defined(NET_TS_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)

// Windows: object handles.
#if !defined(NET_TS_HAS_WINDOWS_OBJECT_HANDLE)
# if !defined(NET_TS_DISABLE_WINDOWS_OBJECT_HANDLE)
#  if defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
#   if !defined(UNDER_CE) && !defined(NET_TS_WINDOWS_APP)
#    define NET_TS_HAS_WINDOWS_OBJECT_HANDLE 1
#   endif // !defined(UNDER_CE) && !defined(NET_TS_WINDOWS_APP)
#  endif // defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
# endif // !defined(NET_TS_DISABLE_WINDOWS_OBJECT_HANDLE)
#endif // !defined(NET_TS_HAS_WINDOWS_OBJECT_HANDLE)

// Windows: OVERLAPPED wrapper.
#if !defined(NET_TS_HAS_WINDOWS_OVERLAPPED_PTR)
# if !defined(NET_TS_DISABLE_WINDOWS_OVERLAPPED_PTR)
#  if defined(NET_TS_HAS_IOCP)
#   define NET_TS_HAS_WINDOWS_OVERLAPPED_PTR 1
#  endif // defined(NET_TS_HAS_IOCP)
# endif // !defined(NET_TS_DISABLE_WINDOWS_OVERLAPPED_PTR)
#endif // !defined(NET_TS_HAS_WINDOWS_OVERLAPPED_PTR)

// POSIX: stream-oriented file descriptors.
#if !defined(NET_TS_HAS_POSIX_STREAM_DESCRIPTOR)
# if !defined(NET_TS_DISABLE_POSIX_STREAM_DESCRIPTOR)
#  if !defined(NET_TS_WINDOWS) \
  && !defined(NET_TS_WINDOWS_RUNTIME) \
  && !defined(__CYGWIN__)
#   define NET_TS_HAS_POSIX_STREAM_DESCRIPTOR 1
#  endif // !defined(NET_TS_WINDOWS)
         //   && !defined(NET_TS_WINDOWS_RUNTIME)
         //   && !defined(__CYGWIN__)
# endif // !defined(NET_TS_DISABLE_POSIX_STREAM_DESCRIPTOR)
#endif // !defined(NET_TS_HAS_POSIX_STREAM_DESCRIPTOR)

// UNIX domain sockets.
#if !defined(NET_TS_HAS_LOCAL_SOCKETS)
# if !defined(NET_TS_DISABLE_LOCAL_SOCKETS)
#  if !defined(NET_TS_WINDOWS) \
  && !defined(NET_TS_WINDOWS_RUNTIME) \
  && !defined(__CYGWIN__)
#   define NET_TS_HAS_LOCAL_SOCKETS 1
#  endif // !defined(NET_TS_WINDOWS)
         //   && !defined(NET_TS_WINDOWS_RUNTIME)
         //   && !defined(__CYGWIN__)
# endif // !defined(NET_TS_DISABLE_LOCAL_SOCKETS)
#endif // !defined(NET_TS_HAS_LOCAL_SOCKETS)

// Can use sigaction() instead of signal().
#if !defined(NET_TS_HAS_SIGACTION)
# if !defined(NET_TS_DISABLE_SIGACTION)
#  if !defined(NET_TS_WINDOWS) \
  && !defined(NET_TS_WINDOWS_RUNTIME) \
  && !defined(__CYGWIN__)
#   define NET_TS_HAS_SIGACTION 1
#  endif // !defined(NET_TS_WINDOWS)
         //   && !defined(NET_TS_WINDOWS_RUNTIME)
         //   && !defined(__CYGWIN__)
# endif // !defined(NET_TS_DISABLE_SIGACTION)
#endif // !defined(NET_TS_HAS_SIGACTION)

// Can use signal().
#if !defined(NET_TS_HAS_SIGNAL)
# if !defined(NET_TS_DISABLE_SIGNAL)
#  if !defined(UNDER_CE)
#   define NET_TS_HAS_SIGNAL 1
#  endif // !defined(UNDER_CE)
# endif // !defined(NET_TS_DISABLE_SIGNAL)
#endif // !defined(NET_TS_HAS_SIGNAL)

// Can use getaddrinfo() and getnameinfo().
#if !defined(NET_TS_HAS_GETADDRINFO)
# if !defined(NET_TS_DISABLE_GETADDRINFO)
#  if defined(NET_TS_WINDOWS) || defined(__CYGWIN__)
#   if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
#    define NET_TS_HAS_GETADDRINFO 1
#   elif defined(UNDER_CE)
#    define NET_TS_HAS_GETADDRINFO 1
#   endif // defined(UNDER_CE)
#  elif defined(__MACH__) && defined(__APPLE__)
#   if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
#    if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
#     define NET_TS_HAS_GETADDRINFO 1
#    endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
#   else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
#    define NET_TS_HAS_GETADDRINFO 1
#   endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
#  else // defined(__MACH__) && defined(__APPLE__)
#   define NET_TS_HAS_GETADDRINFO 1
#  endif // defined(__MACH__) && defined(__APPLE__)
# endif // !defined(NET_TS_DISABLE_GETADDRINFO)
#endif // !defined(NET_TS_HAS_GETADDRINFO)

// Whether standard iostreams are disabled.
#if !defined(NET_TS_NO_IOSTREAM)
# if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
#  define NET_TS_NO_IOSTREAM 1
# endif // !defined(BOOST_NO_IOSTREAM)
#endif // !defined(NET_TS_NO_IOSTREAM)

// Whether exception handling is disabled.
#if !defined(NET_TS_NO_EXCEPTIONS)
# if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
#  define NET_TS_NO_EXCEPTIONS 1
# endif // !defined(BOOST_NO_EXCEPTIONS)
#endif // !defined(NET_TS_NO_EXCEPTIONS)

// Whether the typeid operator is supported.
#if !defined(NET_TS_NO_TYPEID)
# if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
#  define NET_TS_NO_TYPEID 1
# endif // !defined(BOOST_NO_TYPEID)
#endif // !defined(NET_TS_NO_TYPEID)

// Threads.
#if !defined(NET_TS_HAS_THREADS)
# if !defined(NET_TS_DISABLE_THREADS)
#  if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
#   define NET_TS_HAS_THREADS 1
#  elif defined(__GNUC__) && !defined(__MINGW32__) \
     && !defined(linux) && !defined(__linux) && !defined(__linux__)
#   define NET_TS_HAS_THREADS 1
#  elif defined(_MT) || defined(__MT__)
#   define NET_TS_HAS_THREADS 1
#  elif defined(_REENTRANT)
#   define NET_TS_HAS_THREADS 1
#  elif defined(__APPLE__)
#   define NET_TS_HAS_THREADS 1
#  elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
#   define NET_TS_HAS_THREADS 1
#  elif defined(_PTHREADS)
#   define NET_TS_HAS_THREADS 1
#  endif // defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
# endif // !defined(NET_TS_DISABLE_THREADS)
#endif // !defined(NET_TS_HAS_THREADS)

// POSIX threads.
#if !defined(NET_TS_HAS_PTHREADS)
# if defined(NET_TS_HAS_THREADS)
#  if defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
#   define NET_TS_HAS_PTHREADS 1
#  elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
#   define NET_TS_HAS_PTHREADS 1
#  endif // defined(NET_TS_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
# endif // defined(NET_TS_HAS_THREADS)
#endif // !defined(NET_TS_HAS_PTHREADS)

// Helper to prevent macro expansion.
#define NET_TS_PREVENT_MACRO_SUBSTITUTION

// Helper to define in-class constants.
#if !defined(NET_TS_STATIC_CONSTANT)
# if !defined(NET_TS_DISABLE_BOOST_STATIC_CONSTANT)
#  define NET_TS_STATIC_CONSTANT(type, assignment) \
    BOOST_STATIC_CONSTANT(type, assignment)
# else // !defined(NET_TS_DISABLE_BOOST_STATIC_CONSTANT)
#  define NET_TS_STATIC_CONSTANT(type, assignment) \
    static const type assignment
# endif // !defined(NET_TS_DISABLE_BOOST_STATIC_CONSTANT)
#endif // !defined(NET_TS_STATIC_CONSTANT)

// Boost array library.
#if !defined(NET_TS_HAS_BOOST_ARRAY)
# if !defined(NET_TS_DISABLE_BOOST_ARRAY)
#  define NET_TS_HAS_BOOST_ARRAY 1
# endif // !defined(NET_TS_DISABLE_BOOST_ARRAY)
#endif // !defined(NET_TS_HAS_BOOST_ARRAY)

// Boost assert macro.
#if !defined(NET_TS_HAS_BOOST_ASSERT)
# if !defined(NET_TS_DISABLE_BOOST_ASSERT)
#  define NET_TS_HAS_BOOST_ASSERT 1
# endif // !defined(NET_TS_DISABLE_BOOST_ASSERT)
#endif // !defined(NET_TS_HAS_BOOST_ASSERT)

// Boost limits header.
#if !defined(NET_TS_HAS_BOOST_LIMITS)
# if !defined(NET_TS_DISABLE_BOOST_LIMITS)
#  define NET_TS_HAS_BOOST_LIMITS 1
# endif // !defined(NET_TS_DISABLE_BOOST_LIMITS)
#endif // !defined(NET_TS_HAS_BOOST_LIMITS)

// Boost throw_exception function.
#if !defined(NET_TS_HAS_BOOST_THROW_EXCEPTION)
# if !defined(NET_TS_DISABLE_BOOST_THROW_EXCEPTION)
#  define NET_TS_HAS_BOOST_THROW_EXCEPTION 1
# endif // !defined(NET_TS_DISABLE_BOOST_THROW_EXCEPTION)
#endif // !defined(NET_TS_HAS_BOOST_THROW_EXCEPTION)

// Boost regex library.
#if !defined(NET_TS_HAS_BOOST_REGEX)
# if !defined(NET_TS_DISABLE_BOOST_REGEX)
#  define NET_TS_HAS_BOOST_REGEX 1
# endif // !defined(NET_TS_DISABLE_BOOST_REGEX)
#endif // !defined(NET_TS_HAS_BOOST_REGEX)

// Boost bind function.
#if !defined(NET_TS_HAS_BOOST_BIND)
# if !defined(NET_TS_DISABLE_BOOST_BIND)
#  define NET_TS_HAS_BOOST_BIND 1
# endif // !defined(NET_TS_DISABLE_BOOST_BIND)
#endif // !defined(NET_TS_HAS_BOOST_BIND)

// Boost's BOOST_WORKAROUND macro.
#if !defined(NET_TS_HAS_BOOST_WORKAROUND)
# if !defined(NET_TS_DISABLE_BOOST_WORKAROUND)
#  define NET_TS_HAS_BOOST_WORKAROUND 1
# endif // !defined(NET_TS_DISABLE_BOOST_WORKAROUND)
#endif // !defined(NET_TS_HAS_BOOST_WORKAROUND)

// Microsoft Visual C++'s secure C runtime library.
#if !defined(NET_TS_HAS_SECURE_RTL)
# if !defined(NET_TS_DISABLE_SECURE_RTL)
#  if defined(NET_TS_MSVC) \
    && (NET_TS_MSVC >= 1400) \
    && !defined(UNDER_CE)
#   define NET_TS_HAS_SECURE_RTL 1
#  endif // defined(NET_TS_MSVC)
         // && (NET_TS_MSVC >= 1400)
         // && !defined(UNDER_CE)
# endif // !defined(NET_TS_DISABLE_SECURE_RTL)
#endif // !defined(NET_TS_HAS_SECURE_RTL)

// Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
#if !defined(NET_TS_HAS_HANDLER_HOOKS)
# if !defined(NET_TS_DISABLE_HANDLER_HOOKS)
#  if defined(__GNUC__)
#   if (__GNUC__ >= 3)
#    define NET_TS_HAS_HANDLER_HOOKS 1
#   endif // (__GNUC__ >= 3)
#  elif !defined(__BORLANDC__)
#   define NET_TS_HAS_HANDLER_HOOKS 1
#  endif // !defined(__BORLANDC__)
# endif // !defined(NET_TS_DISABLE_HANDLER_HOOKS)
#endif // !defined(NET_TS_HAS_HANDLER_HOOKS)

// Support for the __thread keyword extension.
#if !defined(NET_TS_DISABLE_THREAD_KEYWORD_EXTENSION)
# if defined(__linux__)
#  if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#   if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
#    if !defined(__INTEL_COMPILER) && !defined(__ICL) \
       && !(defined(__clang__) && defined(__ANDROID__))
#     define NET_TS_HAS_THREAD_KEYWORD_EXTENSION 1
#     define NET_TS_THREAD_KEYWORD __thread
#    elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
#     define NET_TS_HAS_THREAD_KEYWORD_EXTENSION 1
#    endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
           // && !(defined(__clang__) && defined(__ANDROID__))
#   endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
#  endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
# endif // defined(__linux__)
# if defined(NET_TS_MSVC) && defined(NET_TS_WINDOWS_RUNTIME)
#  if (_MSC_VER >= 1700)
#   define NET_TS_HAS_THREAD_KEYWORD_EXTENSION 1
#   define NET_TS_THREAD_KEYWORD __declspec(thread)
#  endif // (_MSC_VER >= 1700)
# endif // defined(NET_TS_MSVC) && defined(NET_TS_WINDOWS_RUNTIME)
#endif // !defined(NET_TS_DISABLE_THREAD_KEYWORD_EXTENSION)
#if !defined(NET_TS_THREAD_KEYWORD)
# define NET_TS_THREAD_KEYWORD __thread
#endif // !defined(NET_TS_THREAD_KEYWORD)

// Support for POSIX ssize_t typedef.
#if !defined(NET_TS_DISABLE_SSIZE_T)
# if defined(__linux__) \
   || (defined(__MACH__) && defined(__APPLE__))
#  define NET_TS_HAS_SSIZE_T 1
# endif // defined(__linux__)
        //   || (defined(__MACH__) && defined(__APPLE__))
#endif // !defined(NET_TS_DISABLE_SSIZE_T)

// Helper macros to manage the transition away from the old services-based API.
#define NET_TS_SVC_TPARAM
#define NET_TS_SVC_TPARAM_DEF1(d1)
#define NET_TS_SVC_TPARAM_DEF2(d1, d2)
#define NET_TS_SVC_TARG
// NET_TS_SVC_T is defined at each point of use.
#define NET_TS_SVC_TPARAM1
#define NET_TS_SVC_TPARAM1_DEF1(d1)
#define NET_TS_SVC_TPARAM1_DEF2(d1, d2)
#define NET_TS_SVC_TARG1
// NET_TS_SVC_T1 is defined at each point of use.
#define NET_TS_SVC_ACCESS protected

// Helper macros to manage transition away from error_code return values.
#define NET_TS_SYNC_OP_VOID void
#define NET_TS_SYNC_OP_VOID_RETURN(e) return
// Newer gcc, clang need special treatment to suppress unused typedef warnings.
#if defined(__clang__)
# if defined(__apple_build_version__)
#  if (__clang_major__ >= 7)
#   define NET_TS_UNUSED_TYPEDEF __attribute__((__unused__))
#  endif // (__clang_major__ >= 7)
# elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
    || (__clang_major__ > 3)
#  define NET_TS_UNUSED_TYPEDEF __attribute__((__unused__))
# endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
        //   || (__clang_major__ > 3)
#elif defined(__GNUC__)
# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
#  define NET_TS_UNUSED_TYPEDEF __attribute__((__unused__))
# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
#endif // defined(__GNUC__)
#if !defined(NET_TS_UNUSED_TYPEDEF)
# define NET_TS_UNUSED_TYPEDEF
#endif // !defined(NET_TS_UNUSED_TYPEDEF)

// Some versions of gcc generate spurious warnings about unused variables.
#if defined(__GNUC__)
# if (__GNUC__ >= 4)
#  define NET_TS_UNUSED_VARIABLE __attribute__((__unused__))
# endif // (__GNUC__ >= 4)
#endif // defined(__GNUC__)
#if !defined(NET_TS_UNUSED_VARIABLE)
# define NET_TS_UNUSED_VARIABLE
#endif // !defined(NET_TS_UNUSED_VARIABLE)

// Support co_await on compilers known to allow it.
#if !defined(NET_TS_HAS_CO_AWAIT)
# if !defined(NET_TS_DISABLE_CO_AWAIT)
#  if defined(NET_TS_MSVC)
#   if (_MSC_FULL_VER >= 190023506)
#    if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
#     define NET_TS_HAS_CO_AWAIT 1
#    endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
#   endif // (_MSC_FULL_VER >= 190023506)
#  endif // defined(NET_TS_MSVC)
# endif // !defined(NET_TS_DISABLE_CO_AWAIT)
# if defined(__clang__)
#  if (__cpp_coroutines >= 201703)
#   if __has_include(<experimental/coroutine>)
#    define NET_TS_HAS_CO_AWAIT 1
#   endif // __has_include(<experimental/coroutine>)
#  endif // (__cpp_coroutines >= 201703)
# endif // defined(__clang__)
#endif // !defined(NET_TS_HAS_CO_AWAIT)

#endif // NET_TS_DETAIL_CONFIG_HPP

{'repo_name': 'chriskohlhoff/networking-ts-impl', 'stars': '197', 'repo_language': 'C++', 'file_name': 'endpoint.ipp', 'mime_type': 'text/x-c++', 'hash': 8737622219930738036, 'source_dataset': 'data'}


<% content_for :full_page_content do %>
  <%= react_component("inbox", props: {
    userDisplayName: current_user.display_name,
    dropdownUrls: dropdown_urls,
    feedbackUrl: feedback_url,
    buildDate: build_date,
    flash: flash,
    inbox: {
      messages: messages,
      pagination: pagination
    }
  }) %>
<% end %>

{'repo_name': 'department-of-veterans-affairs/caseflow', 'stars': '101', 'repo_language': 'Ruby', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -7854718003675944319, 'source_dataset': 'data'}


// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

#if NETFX_CORE // This file should only be included by the NetCore version of the formatting project, but adding a guard here just in case.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace System.Net.Http.Internal
{
    // TODO: Remove this class after BCL makes their portable library version.
    internal sealed class ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>
    {
        private Dictionary<TKey, TValue> _dictionary = new Dictionary<TKey, TValue>();
        private object _lock = new object();

        public ICollection<TKey> Keys
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public ICollection<TValue> Values
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public int Count
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public bool IsReadOnly
        {
            get
            {
                return ((IDictionary)_dictionary).IsReadOnly;
            }
        }

        public TValue this[TKey key]
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public void Add(TKey key, TValue value)
        {
            throw new NotImplementedException();
        }

        public bool ContainsKey(TKey key)
        {
            lock (_lock)
            {
                return _dictionary.ContainsKey(key);
            }
        }

        public bool Remove(TKey key)
        {
            throw new NotImplementedException();
        }

        public bool TryGetValue(TKey key, out TValue value)
        {
            lock (_lock)
            {
                return _dictionary.TryGetValue(key, out value);
            }
        }

        public void Add(KeyValuePair<TKey, TValue> item)
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
            throw new NotImplementedException();
        }

        public bool Contains(KeyValuePair<TKey, TValue> item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
        {
            throw new NotImplementedException();
        }

        public bool Remove(KeyValuePair<TKey, TValue> item)
        {
            throw new NotImplementedException();
        }

        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }

        // ConcurrentDictionary members
        public bool TryRemove(TKey key, out TValue removedValue)
        {
            lock (_lock)
            {
                if (_dictionary.TryGetValue(key, out removedValue))
                {
                    return _dictionary.Remove(key);
                }

                return false;
            }
        }

        public TValue GetOrAdd(TKey key, Func<TKey, TValue> addValueFactory)
        {
            lock (_lock)
            {
                TValue value;

                if (!_dictionary.TryGetValue(key, out value))
                {
                    value = addValueFactory.Invoke(key);
                    _dictionary.Add(key, value);
                }

                return value;
            }
        }

        public bool TryAdd(TKey key, TValue value)
        {
            lock (_lock)
            {
                if (_dictionary.ContainsKey(key))
                {
                    return false;
                }

                _dictionary.Add(key, value);
                return true;
            }
        }

        public TValue AddOrUpdate(TKey key, TValue addValue, Func<TKey, TValue, TValue> updateValueFactory)
        {
            lock (_lock)
            {
                TValue value;

                // update
                if (_dictionary.TryGetValue(key, out value))
                {
                    value = updateValueFactory.Invoke(key, value);
                    _dictionary[key] = value;
                    return value;
                }

                // add
                _dictionary.Add(key, addValue);
                return addValue;
            }
        }
    }
}
#endif

{'repo_name': 'aspnet/AspNetWebStack', 'stars': '607', 'repo_language': 'C#', 'file_name': 'DefaultExceptionHandlerTests.cs', 'mime_type': 'text/plain', 'hash': 7723157684174438343, 'source_dataset': 'data'}


import gdb

from clasp_inspect.interface import Interface
from clasp_inspect.object_layout import *

global_udb_interface = None

class UdbInterface(Interface):
    def __init__(self,debugger,internal_dict,prefix):
        global global_Structs
        print "In clasp_inspect for gdb_interface"
        filename = "/tmp/clasp-layout.py"
        with open(filename, "rb") as source_file:
            code = compile(source_file.read(), filename, "exec")
        exec(code)
        SetupGlobals(self)

    def print(self,msg):
        print msg

    def read_memory(self,address,len):
        i = gdb.inferiors()[0]
        m = i.read_memory(address,len)
        return m

def inspect(args):
    print "In inspect"
    # global global_lldb_interface
    # args = command.split(" ")
    # arg = args[0]
    # verbose = False
    # if (len(args)>1):
    #     verbose = True
    # ptr = None
    # if (arg[0:2]=='$r'):
    #     debugger.print("Handle register %s\n" % arg)
    #     return
    # if (is_int(arg,16)):
    #     tptr = int(arg,16)
    # elif (is_int(arg,10)):
    #     tptr = int(arg,10)
    # else:
    #     key = lldb.frame.FindVariable(arg)
    #     if (verbose): debugger.print("arg = %s" % key)
    #     theObject = key.GetChildMemberWithName("theObject")
    #     # theObject.GetValue() returns a string - why? dunno
    #     if (verbose): debugger.print("theObject.GetValue() = %s" % theObject.GetValue())
    #     tptr = int(theObject.GetValue(),16)
    # print_tagged_ptr(global_lldb_interface,verbose,tptr,toplevel=True)

def do_udb_init_module():
    global global_lldb_interface
    prefix = "%s.clasp_inspect.lldb_interface" % prefix
    print("In do_lldb_init_module")
    print("installing %s.inspect" % prefix)
    debugger.HandleCommand('command script add -f %s.inspect il' % prefix)
    global_lldb_interface = UdbInterface(debugger,internal_dict,prefix)
    print("Leaving do_lldb_init_module")

{'repo_name': 'clasp-developers/clasp', 'stars': '1695', 'repo_language': 'C++', 'file_name': 'ecl_Copyright', 'mime_type': 'text/plain', 'hash': -2521983429230177011, 'source_dataset': 'data'}


package com.beepiz.bluetooth.gattcoroutines

import android.annotation.SuppressLint
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothGatt
import android.bluetooth.BluetoothGattDescriptor
import android.bluetooth.BluetoothGattService
import androidx.annotation.RequiresApi
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.withTimeout
import java.util.UUID

/**
 * The entry point of BluetoothGatt with coroutines.
 *
 * Create an instance by passing a Low Energy compatible [BluetoothDevice], then
 * call [connect] when you need to perform operations, perform your operations, and when you're
 * done, call [close] or [disconnect].
 *
 * All the functions of this interface can throw one of the following exceptions:
 * - [ConnectionClosedException]
 * - [GattException] (either [OperationFailedException] or [OperationInitiationFailedException])
 *
 * You should catch them and react appropriately (fixing your code, fixing the device if you can,
 * closing the connection and retrying (with linear/exponential backoff), and/or inform the user,
 * allowing manual retry if appropriate and/or cancel.
 *
 * Note that [discoverServices] is usually the first call you want to make after calling [connect].
 *
 * The default implementation of this interface can be instantiated with the [invoke] operator
 * function.
 *
 * **For production apps, see [stateChangeChannel].**
 */
@ExperimentalBleGattCoroutinesCoroutinesApi
interface GattConnection {
    companion object {
        @RequiresApi(18)
        @ExperimentalCoroutinesApi
        @ObsoleteCoroutinesApi
        operator fun invoke(
            bluetoothDevice: BluetoothDevice,
            connectionSettings: ConnectionSettings = ConnectionSettings()
        ): GattConnection = GattConnectionImpl(bluetoothDevice, connectionSettings)

        /**
         * The characteristic used to enable notifications on the remote device in the
         * [setCharacteristicNotificationsEnabledOnRemoteDevice] function.
         *
         * Sources:
         * - [Android sample](https://github.com/googlesamples/android-BluetoothLeGatt/blob/74c0006b9e87112d09bc6ed2cb3fcb51b07af4a4/Application/src/main/java/com/example/android/bluetoothlegatt/SampleGattAttributes.java#L27)
         * - [Official Bluetooth website](https://www.bluetooth.com/specifications/gatt/descriptors/)
         * (look for `0x2902` or "Client Characteristic Configuration")
         */
        @JvmField
        val clientCharacteristicConfiguration: UUID =
            UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
    }

    @SuppressLint("InlinedApi")
    class ConnectionSettings(
        val autoConnect: Boolean = false,
        val allowAutoConnect: Boolean = autoConnect,
        val disconnectOnClose: Boolean = true,
        val transport: Int = BluetoothDevice.TRANSPORT_AUTO,
        val phy: Int = BluetoothDevice.PHY_LE_1M_MASK
    ) {
        init {
            if (autoConnect) require(allowAutoConnect)
        }
    }

    val bluetoothDevice: BluetoothDevice

    val isConnected: Boolean
    /**
     * Suspends until a connection is established with the target device, or throws if an error
     * happens.
     *
     * It is **strongly recommended** to wrap this call with [withTimeout] as this method may never
     * resume if the target device is not in range. A timeout of about 5 seconds is recommended.
     *
     * Note that after any timeout, it is **your responsibility to close this [GattConnection]
     * instance**. However, this may change in a future version of the library.
     *
     * **There's a max concurrent GATT connections** which is 4 on Android 4.3 and
     * 7 on Android 4.4+. Keep in mind the user may already have a few connected devices such
     * as a SmartWatch, that top notch Bluetooth headset, or whatever which count as GATT
     * connections too. Call [close] when you don't need the connection anymore, or [disconnect]
     * if you don't need the connection to stay active for some amount of time.
     */
    suspend fun connect()

    /**
     * Suspends until the target device is disconnected, or throw if an error happens.
     *
     * Useful if you want to disconnect from the device for a relatively short time and connect
     * back later using this same instance.
     */
    suspend fun disconnect()

    /**
     * No need to disconnect first if you call this method.
     *
     * This [GattConnection] instance is no longer usable after this has been called, and all
     * coroutines suspended on calls to this instance will receive a cancellation signal.
     */
    fun close(notifyStateChangeChannel: Boolean = false)

    /** Reads the RSSI for a connected remote device */
    suspend fun readRemoteRssi(): Int

    /**
     * Use this method only if needed, and do so carefully.
     * See [BluetoothGatt.requestConnectionPriority].
     *
     * Accepted values are [BluetoothGatt.CONNECTION_PRIORITY_LOW_POWER],
     * [BluetoothGatt.CONNECTION_PRIORITY_BALANCED] (default) and
     * [BluetoothGatt.CONNECTION_PRIORITY_HIGH]. Read the documentation of the constant you use.
     *
     * Throws an [OperationInitiationFailedException] if the device is not connected.
     */
    @RequiresApi(21)
    fun requestPriority(priority: Int)

    /**
     * This is usually the first call you make after calling [connect].
     *
     * Discovers services offered by the remote device as well as its characteristics and
     * its descriptors.
     */
    suspend fun discoverServices(): List<BluetoothGattService>

    /**
     * **Note:** You can use [openNotificationSubscription] that automatically calls this function
     * for you.
     *
     * Enable or disable notifications/indications for the passed [characteristic].
     * Once notifications are enabled for a characteristic, the [notifyChannel] will receive updated
     * characteristic if the remote device indicates that is has changed.
     *
     * Note that **there is a concurrent active notifications limit**, which, according to
     * [this video](https://youtu.be/qx55Sa8UZAQ?t=28m30s) is **4 on Android 4.3**,
     * 7 on Android 4.4, and 15 on Android 5.0+.
     */
    fun setCharacteristicNotificationsEnabled(characteristic: BGC, enable: Boolean)

    /**
     * Enables notifications for that [characteristic] client-side (you still need to enable it
     * on the remote device) and returns a [ReceiveChannel] that will get the notifications for that
     * characteristic only.
     *
     * By default, [disableNotificationsOnChannelClose] is true, and will cause the notifications
     * to be disabled client-side when the channel is closed/consumed.
     *
     * **IMPORTANT**: On most BLE devices, you'll need to enable notifications on the remote device
     * too. You can do so with the [setCharacteristicNotificationsEnabledOnRemoteDevice] function.
     *
     * You can enable notifications on the remote device before or after calling this function, both
     * ways, notifications will be able to arrive once enabling on remote device completes.
     */
    fun openNotificationSubscription(
        characteristic: BGC,
        disableNotificationsOnChannelClose: Boolean = true
    ): ReceiveChannel<BGC>

    /**
     * Checks that the passed [characteristic] supports notifications (it should come from
     * [discoverServices]), and writes the [clientCharacteristicConfiguration] with
     * [BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE] if [enable] is true, or
     * [BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE] otherwise.
     *
     * If successful, notifications for that characteristic should be enabled on the remote device
     * and you can now receive them from [openNotificationSubscription] (or from [notifyChannel] if
     * you called [setCharacteristicNotificationsEnabled] beforehand).
     */
    suspend fun setCharacteristicNotificationsEnabledOnRemoteDevice(
        characteristic: BGC,
        enable: Boolean
    )

    /**
     * This function requires that service discovery has been completed
     * for the given device.
     *
     * If multiple instances of the same service (as identified by UUID)
     * exist, the first instance of the service is returned.
     *
     * @param uuid UUID of the requested service
     * @return The service of the requested UUID if supported by the remote device, or null
     */
    fun getService(uuid: UUID): BluetoothGattService?

    suspend fun readCharacteristic(characteristic: BGC): BGC
    suspend fun writeCharacteristic(characteristic: BGC): BGC
    @RequiresApi(19)
    suspend fun reliableWrite(writeOperations: suspend GattConnection.() -> Unit)

    suspend fun readDescriptor(desc: BGD): BGD
    suspend fun writeDescriptor(desc: BGD): BGD
    @RequiresApi(26)
    suspend fun readPhy(): Phy

    suspend fun requestMtu(mtu: Int): Int

    /**
     * **You should totally use this channel and implement the appropriate behavior for a production
     * app.**
     *
     * Dispatches fine grained connection changes, including errors.
     * You can consume this channel in a separate coroutine (without awaiting completion,
     * unless you want to await until [close] is called) and perform the logic you want according
     * to connection state changes. For example, in case of a 133 status, you could retry connection
     * a few times by calling [connect] again, or call [close] and alert the user if needed after
     * multiple errors.
     * This channel will also receive disconnections that can happen if the device
     * gets out of range for example. It's then up to you to decide to retry [connect] a few times,
     * periodically, alert the user or call [close].
     */
    val stateChangeChannel: ReceiveChannel<StateChange>

    /**
     * Receives all characteristic update notifications.
     *
     * If you need to get the notifications of only a specific characteristic, you may want to use
     * the [openNotificationSubscription] function instead.
     *
     * Since version 0.4.0, in the default implementation, this channel is backed by a
     * [BroadcastChannel], which means you can have multiple consumers as each time you get this
     * property, a new subscription is opened.
     *
     * For characteristic notifications to come in this channel, you need to enable it on
     * client-side (using [setCharacteristicNotificationsEnabled]), and they also need to be enabled
     * on the remote device (you can enable it with the
     * [setCharacteristicNotificationsEnabledOnRemoteDevice] function).
     */
    val notifyChannel: ReceiveChannel<BGC>

    data class StateChange internal constructor(val status: Int, val newState: Int)
    data class Phy(val tx: Int, val rx: Int)
}

{'repo_name': 'Beepiz/BleGattCoroutines', 'stars': '301', 'repo_language': 'Kotlin', 'file_name': 'strings.xml', 'mime_type': 'text/plain', 'hash': 3374792992681304741, 'source_dataset': 'data'}


Pod::Spec.new do |s|
  s.name          = 'RSKPlaceholderTextView'
  s.version       = '6.0.3'
  s.summary       = 'A light-weight UITextView subclass that adds support for placeholder.'
  s.homepage      = 'https://github.com/ruslanskorb/RSKPlaceholderTextView'
  s.license       = { :type => 'Apache', :file => 'LICENSE' }
  s.authors       = { 'Ruslan Skorb' => 'ruslan.skorb@gmail.com' }
  s.source        = { :git => 'https://github.com/ruslanskorb/RSKPlaceholderTextView.git', :tag => s.version.to_s }
  s.platform      = :ios, '9.0'
  s.swift_version = '5.1'
  s.source_files  = 'RSKPlaceholderTextView/*.{swift}'
  s.framework     = 'UIKit'
  s.requires_arc  = true
end

{'repo_name': 'ruslanskorb/RSKPlaceholderTextView', 'stars': '163', 'repo_language': 'Swift', 'file_name': 'Info.plist', 'mime_type': 'text/xml', 'hash': -5596860320616893651, 'source_dataset': 'data'}


# Example Rakefile -*- ruby -*-
# Using the power of Ruby

task :default => [:main]

def ext(fn, newext)
  fn.sub(/\.[^.]+$/, newext)
end

SRCFILES = Dir['*.c']
OBJFILES = SRCFILES.collect { |fn| ext(fn,".o") }

OBJFILES.each do |objfile|
  srcfile = ext(objfile, ".c")
  file objfile => [srcfile] do |t|
    sh "gcc #{srcfile} -c -o #{t.name}"
  end
end

file "main" => OBJFILES do |t|
  sh "gcc -o #{t.name} main.o a.o b.o"
end

task :clean do
  rm_f FileList['*.o']
  Dir['*~'].each { |fn| rm_f fn }
end

task :clobber => [:clean] do
  rm_f "main"
end

task :run => ["main"] do
  sh "./main"
end

{'repo_name': 'wycats/merb', 'stars': '341', 'repo_language': 'Ruby', 'file_name': 'namespaced_generator.rb', 'mime_type': 'text/x-ruby', 'hash': 4671758486288821494, 'source_dataset': 'data'}


{'repo_name': 'Azure/usql', 'stars': '216', 'repo_language': 'C#', 'file_name': 'USQL_Selfguided_HOL.md', 'mime_type': 'text/plain', 'hash': -4137555050457830711, 'source_dataset': 'data'}


/*
 * Copyright 2013 Red Hat Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: Ben Skeggs
 */
#include "gf100.h"

static int
gk110_pm_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
	      struct nvkm_oclass *oclass, void *data, u32 size,
	      struct nvkm_object **pobject)
{
	struct gf100_pm_priv *priv;
	int ret;

	ret = nvkm_pm_create(parent, engine, oclass, &priv);
	*pobject = nv_object(priv);
	if (ret)
		return ret;

	ret = nvkm_perfdom_new(&priv->base, "pwr", 0, 0, 0, 0, gk104_pm_pwr);
	if (ret)
		return ret;

	nv_engine(priv)->cclass = &nvkm_pm_cclass;
	nv_engine(priv)->sclass =  nvkm_pm_sclass;
	return 0;
}

struct nvkm_oclass
gk110_pm_oclass = {
	.handle = NV_ENGINE(PM, 0xf0),
	.ofuncs = &(struct nvkm_ofuncs) {
		.ctor = gk110_pm_ctor,
		.dtor = _nvkm_pm_dtor,
		.init = _nvkm_pm_init,
		.fini = gf100_pm_fini,
	},
};

{'repo_name': 'ljrcore/linuxmooc', 'stars': '217', 'repo_language': 'C', 'file_name': 'ecc.c', 'mime_type': 'text/x-c', 'hash': -1426796806098859056, 'source_dataset': 'data'}


// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build linux
// +build mips mipsle

package unix

import (
	"syscall"
	"unsafe"
)

func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)

//sys	Dup2(oldfd int, newfd int) (err error)
//sysnb	EpollCreate(size int) (fd int, err error)
//sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
//sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
//sys	Fchown(fd int, uid int, gid int) (err error)
//sys	Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
//sysnb	Getegid() (egid int)
//sysnb	Geteuid() (euid int)
//sysnb	Getgid() (gid int)
//sysnb	Getuid() (uid int)
//sys	Lchown(path string, uid int, gid int) (err error)
//sys	Listen(s int, n int) (err error)
//sys	Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys	Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys	Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys	Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
//sys	sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
//sys	setfsgid(gid int) (prev int, err error)
//sys	setfsuid(uid int) (prev int, err error)
//sysnb	Setregid(rgid int, egid int) (err error)
//sysnb	Setresgid(rgid int, egid int, sgid int) (err error)
//sysnb	Setresuid(ruid int, euid int, suid int) (err error)
//sysnb	Setreuid(ruid int, euid int) (err error)
//sys	Shutdown(fd int, how int) (err error)
//sys	Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
//sys	SyncFileRange(fd int, off int64, n int64, flags int) (err error)
//sys	Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
//sys	Ustat(dev int, ubuf *Ustat_t) (err error)
//sys	accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
//sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
//sys	bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
//sys	connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
//sysnb	getgroups(n int, list *_Gid_t) (nn int, err error)
//sysnb	setgroups(n int, list *_Gid_t) (err error)
//sys	getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
//sys	setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
//sysnb	socket(domain int, typ int, proto int) (fd int, err error)
//sysnb	socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
//sysnb	getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sysnb	getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sys	recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
//sys	sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
//sys	recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys	sendmsg(s int, msg *Msghdr, flags int) (n int, err error)

//sysnb	InotifyInit() (fd int, err error)
//sys	Ioperm(from int, num int, on int) (err error)
//sys	Iopl(level int) (err error)

//sys	futimesat(dirfd int, path string, times *[2]Timeval) (err error)
//sysnb	Gettimeofday(tv *Timeval) (err error)
//sysnb	Time(t *Time_t) (tt Time_t, err error)
//sys	Utime(path string, buf *Utimbuf) (err error)
//sys	utimes(path string, times *[2]Timeval) (err error)

//sys	Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys	Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
//sys	Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
//sys	Stat(path string, stat *Stat_t) (err error) = SYS_STAT64

//sys	Pause() (err error)

func Fstatfs(fd int, buf *Statfs_t) (err error) {
	_, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
	if e != 0 {
		err = errnoErr(e)
	}
	return
}

func Statfs(path string, buf *Statfs_t) (err error) {
	p, err := BytePtrFromString(path)
	if err != nil {
		return err
	}
	_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
	if e != 0 {
		err = errnoErr(e)
	}
	return
}

func Seek(fd int, offset int64, whence int) (off int64, err error) {
	_, _, e := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), uintptr(unsafe.Pointer(&off)), uintptr(whence), 0)
	if e != 0 {
		err = errnoErr(e)
	}
	return
}

func setTimespec(sec, nsec int64) Timespec {
	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
}

func setTimeval(sec, usec int64) Timeval {
	return Timeval{Sec: int32(sec), Usec: int32(usec)}
}

//sysnb pipe2(p *[2]_C_int, flags int) (err error)

func Pipe2(p []int, flags int) (err error) {
	if len(p) != 2 {
		return EINVAL
	}
	var pp [2]_C_int
	err = pipe2(&pp, flags)
	p[0] = int(pp[0])
	p[1] = int(pp[1])
	return
}

//sysnb pipe() (p1 int, p2 int, err error)

func Pipe(p []int) (err error) {
	if len(p) != 2 {
		return EINVAL
	}
	p[0], p[1], err = pipe()
	return
}

//sys	mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)

func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
	page := uintptr(offset / 4096)
	if offset != int64(page)*4096 {
		return 0, EINVAL
	}
	return mmap2(addr, length, prot, flags, fd, page)
}

const rlimInf32 = ^uint32(0)
const rlimInf64 = ^uint64(0)

type rlimit32 struct {
	Cur uint32
	Max uint32
}

//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT

func Getrlimit(resource int, rlim *Rlimit) (err error) {
	err = prlimit(0, resource, nil, rlim)
	if err != ENOSYS {
		return err
	}

	rl := rlimit32{}
	err = getrlimit(resource, &rl)
	if err != nil {
		return
	}

	if rl.Cur == rlimInf32 {
		rlim.Cur = rlimInf64
	} else {
		rlim.Cur = uint64(rl.Cur)
	}

	if rl.Max == rlimInf32 {
		rlim.Max = rlimInf64
	} else {
		rlim.Max = uint64(rl.Max)
	}
	return
}

//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT

func Setrlimit(resource int, rlim *Rlimit) (err error) {
	err = prlimit(0, resource, rlim, nil)
	if err != ENOSYS {
		return err
	}

	rl := rlimit32{}
	if rlim.Cur == rlimInf64 {
		rl.Cur = rlimInf32
	} else if rlim.Cur < uint64(rlimInf32) {
		rl.Cur = uint32(rlim.Cur)
	} else {
		return EINVAL
	}
	if rlim.Max == rlimInf64 {
		rl.Max = rlimInf32
	} else if rlim.Max < uint64(rlimInf32) {
		rl.Max = uint32(rlim.Max)
	} else {
		return EINVAL
	}

	return setrlimit(resource, &rl)
}

func (r *PtraceRegs) PC() uint64 { return r.Epc }

func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }

func (iov *Iovec) SetLen(length int) {
	iov.Len = uint32(length)
}

func (msghdr *Msghdr) SetControllen(length int) {
	msghdr.Controllen = uint32(length)
}

func (msghdr *Msghdr) SetIovlen(length int) {
	msghdr.Iovlen = uint32(length)
}

func (cmsg *Cmsghdr) SetLen(length int) {
	cmsg.Len = uint32(length)
}

//sys	poll(fds *PollFd, nfds int, timeout int) (n int, err error)

func Poll(fds []PollFd, timeout int) (n int, err error) {
	if len(fds) == 0 {
		return poll(nil, 0, timeout)
	}
	return poll(&fds[0], len(fds), timeout)
}

{'repo_name': 'Netflix/titus-executor', 'stars': '191', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': -307508505428648390, 'source_dataset': 'data'}