1
0
forked from boostorg/core

Compare commits

..

3 Commits

Author SHA1 Message Date
Peter Dimov
c17e33d6f2 Update dependencies 2017-06-24 04:08:54 +03:00
Peter Dimov
d426b95281 Update Jamfile to generate dependencies 2017-06-24 03:44:04 +03:00
Peter Dimov
dca0d13ca9 Add cmake files 2017-06-24 00:35:56 +03:00
17 changed files with 360 additions and 410 deletions

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -6,13 +6,14 @@ language: cpp
sudo: false
python: "2.7"
os:
- linux
- osx
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
@@ -25,12 +26,10 @@ matrix:
include:
- os: linux
compiler: g++
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++03
- os: linux
compiler: g++-4.7
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++03
addons:
apt:
packages:
@@ -39,17 +38,34 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.8
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.7
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++03
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.9
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++03
addons:
apt:
packages:
@@ -58,8 +74,16 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++11
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++03
addons:
apt:
packages:
@@ -68,8 +92,25 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++11
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03
addons:
apt:
packages:
@@ -78,35 +119,40 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11
addons:
apt:
packages:
- g++-7
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14
addons:
apt:
packages:
- clang-3.5
- libstdc++-4.9-dev
- g++-6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- os: linux
compiler: clang++-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
- os: linux
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++03
addons:
apt:
packages:
@@ -116,8 +162,17 @@ matrix:
- llvm-toolchain-precise-3.6
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.6
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++03
addons:
apt:
packages:
@@ -127,59 +182,67 @@ matrix:
- llvm-toolchain-precise-3.7
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- os: linux
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++03
addons:
apt:
packages:
- clang-3.8
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++11
addons:
apt:
packages:
- clang-3.9
- libstdc++-4.9-dev
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++14
addons:
apt:
packages:
- clang-4.0
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- llvm-toolchain-precise-3.8
- os: linux
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++1z
addons:
apt:
packages:
- clang-5.0
- clang-3.8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- llvm-toolchain-precise-3.8
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
- os: osx
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/assert
- git submodule init libs/config
@@ -194,8 +257,8 @@ install:
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 libs/core/test toolset=$TOOLSET cxxstd=$CXXSTD
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
- ./b2 libs/core/test toolset=$TOOLSET
notifications:
email:

8
CMakeLists.txt Normal file
View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.5)
include(cmake/BoostVersion.cmake)
set(BOOST_PROJECT_NAME core)
project(boost_${BOOST_PROJECT_NAME} VERSION ${BOOST_VERSION} LANGUAGES CXX)
include(cmake/default.cmake)

View File

@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -11,45 +11,6 @@ branches:
- master
- develop
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-9.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-10.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-11.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++03
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++03
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++03
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXFLAGS: cxxflags=-std=c++11
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
@@ -62,11 +23,10 @@ install:
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core
- cmd /c bootstrap
- bootstrap
- b2 headers
build: off
test_script:
- PATH=%ADDPATH%%PATH%
- b2 libs/core/test toolset=%TOOLSET% %CXXFLAGS%
- b2 libs/core/test toolset=msvc-9.0,msvc-10.0,msvc-11.0,msvc-14.0

1
cmake/BoostVersion.cmake Normal file
View File

@@ -0,0 +1 @@
set(BOOST_VERSION 1.65.0)

20
cmake/Jamfile Normal file
View File

@@ -0,0 +1,20 @@
# Update cmake files
install BoostVersion_ : ../../../BoostVersion.cmake : <location>. ;
install default_ : ../../../cmake/default.cmake : <location>. ;
# Update dependencies
import path ;
path-constant LIBDIR : .. ;
actions boostdep-cmake
{
"$(LIBDIR)/../../dist/bin/boostdep" --cmake $(LIBDIR:B) > $(1)
}
make dependencies.cmake : : @boostdep-cmake ;
always dependencies.cmake ;
install dependencies_ : dependencies.cmake : <location>. ;

103
cmake/default.cmake Normal file
View File

@@ -0,0 +1,103 @@
#
# Default CMakeLists.txt contents for a Boost library
#
# sources.cmake defines ${PROJECT_NAME}_SOURCES
include(cmake/sources.cmake)
if("${${PROJECT_NAME}_SOURCES}" STREQUAL "")
# if no sources, this is a header-only library
add_library(boost_${BOOST_PROJECT_NAME} INTERFACE)
# include directory
target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
else()
# a library that requires building
add_library(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCES})
# include directory
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
endif()
# add namespaced alias
add_library(boost::${BOOST_PROJECT_NAME} ALIAS ${PROJECT_NAME})
# set imported target name to the unqualified name, it will be namespaced
set_property(TARGET ${PROJECT_NAME} PROPERTY EXPORT_NAME ${BOOST_PROJECT_NAME})
# link to dependencies
include(CMakeFindDependencyMacro)
function(boost_declare_dependency package type target)
target_link_libraries(${PROJECT_NAME} ${type} ${target})
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
find_dependency(${package} ${PROJECT_VERSION} EXACT)
endif()
endfunction()
include(cmake/dependencies.cmake)
# target installation
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)
# header installation
install(DIRECTORY include/ DESTINATION include)
# export target info to ${PROJECT_NAME}-targets.cmake, used by -config.cmake
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE boost::
DESTINATION lib/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
)
# install -dependencies.cmake, used by -config.cmake
install(FILES cmake/dependencies.cmake
DESTINATION lib/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
RENAME ${PROJECT_NAME}-dependencies.cmake
)
# write ${PROJECT_NAME}-config.cmake
file(WRITE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" "
include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}-targets.cmake)
include(CMakeFindDependencyMacro)
function(boost_declare_dependency package type target)
find_dependency(\${package} ${PROJECT_VERSION} EXACT)
endfunction()
include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}-dependencies.cmake)
")
include(CMakePackageConfigHelpers)
# write ${PROJECT_NAME}-config-version.cmake
write_basic_package_version_file("${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
# install -config, -config-version
install(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
DESTINATION lib/cmake/${PROJECT_NAME}-${PROJECT_VERSION}
)

4
cmake/dependencies.cmake Normal file
View File

@@ -0,0 +1,4 @@
# Generated file. Do not edit.
boost_declare_dependency(boost_assert INTERFACE boost::assert)
boost_declare_dependency(boost_config INTERFACE boost::config)

0
cmake/sources.cmake Normal file
View File

View File

@@ -18,9 +18,9 @@
[section Header <boost/core/noncopyable.hpp>]
The header `<boost/core/noncopyable.hpp>` defines the class
The header `<boost/noncopyable.hpp>` defines the class
`boost::noncopyable`. It is intended to be used as a private
base class. `boost::noncopyable` has private (under C++03) or
base. `boost::noncopyable` has private (under C++03) or
deleted (under C++11) copy constructor and a copy assignment
operator and can't be copied or assigned; a class that derives
from it inherits these properties.

View File

@@ -27,15 +27,16 @@ for obtaining raw pointers from pointers.
[section Examples]
The following example allocates storage and constructs an object in that
storage using an allocator.
The following function template obtains a raw pointer from a pointer and is
well defined when the pointer aliases storage that has no object constructed
in it.
```
template<class Allocator>
void function(Allocator& a)
template<class T>
inline typename boost::pointer_traits<T>::element_type*
to_raw_pointer(T v) noexcept
{
auto p = a.allocate(1);
std::allocator_traits<Allocator>::construct(a, boost::to_address(p));
return boost::pointer_traits<T>::to_address(v);
}
```
@@ -54,7 +55,7 @@ namespace boost {
template<class U> using rebind = typename rebind_to<U>::type;
static pointer pointer_to(``['see below]`` v);
static element_type* to_address(const pointer& v) noexcept;
static element_type* to_address(pointer v) noexcept;
};
template<class T> struct pointer_traits<T*> {
@@ -68,64 +69,63 @@ namespace boost {
static pointer pointer_to(``['see below]`` v) noexcept;
static element_type* to_address(pointer v) noexcept;
};
template<class T>
typename pointer_traits<T>::element_type* to_address(const T& v) noexcept;
}
```
[section Member types]
[variablelist
[[`typedef` ['see below] `element_type;`]
[`T::element_type` if such a type exists; otherwise `U` if `T` is a class
template instantiation of the form `Pointer<U, Args>`, where `Args` is zero
or more type arguments; otherwise the specialization is ill-formed.]]
[[`typedef` ['see below] `difference_type;`]
[`T::difference_type` if such a type exists; otherwise `std::ptrdiff_t`.]]
[[`template<class U> struct rebind_to { typedef` ['see below] `type; };`]
[`type` is `T::rebind<U>` if such a type exists; otherwise, `Pointer<V, Args>`
if `T` is a class template instantiation of the form `Pointer<T, Args>`,
where `Args` is zero or more type arguments; otherwise, the instantiation of
`rebind_to` is ill-formed.]]]
[[`typedef` ['see below] `element_type;`]
[[variablelist
[[Type]
[`T::element_type` if such a type exists; otherwise `U` if `T` is a
class template instantiation of the form `Pointer<U, Args>`, where
`Args` is zero or more type arguments; otherwise the specialization
is ill-formed.]]]]]
[[`typedef` ['see below] `difference_type;`]
[[variablelist
[[Type]
[`T::difference_type` if such a type exists; otherwise
`std::ptrdiff_t`.]]]]]
[[`template<class U> struct rebind_to { typedef` ['see below] `type; };`]
[[variablelist
[[Type]
[`type` is `T::rebind<U>` if such a type exists; otherwise,
`Pointer<V, Args>` if `T` is a class template instantiation of the
form `Pointer<T, Args>`, where `Args` is zero or more type
arguments; otherwise, the instantiation of `rebind_to` is
ill-formed.]]]]]]
[endsect]
[section Member functions]
[variablelist pointer_traits
[[`static pointer pointer_to(`['see below] `v);`]
[[variablelist
[[Remark]
[If `element_type` is a void type, the type of `v` is unspecified; otherwise,
it is `element_type&`.]]
[[Returns]
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]]
[[`static element_type* to_address(const pointer& v) noexcept;`]
[[variablelist
[[Requires] [`v` is not a null pointer.]]
[[Returns]
[A pointer of type `element_type*` that references the same location
as the argument.]]]]]]
[[`static pointer pointer_to(`['see below] `v);`]
[[variablelist
[[Remark]
[If `element_type` is a void type, the type of `v` is unspecified;
otherwise, it is `element_type&`.]]
[[Returns]
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]]
[[`static element_type* to_address(pointer v) noexcept;`]
[[variablelist
[[Requires]
[`v` is not a null pointer.]]
[[Returns]
[A pointer of type `element_type*` that references the same location
as the argument.]]]]]]
[variablelist pointer_traits<T*>
[[`static pointer pointer_to(`['see below] `v) noexcept;`]
[[variablelist
[[Remark]
[If `element_type` is a void type, the type of `v` is unspecified; otherwise,
it is `element_type&`.]]
[[Returns] [The result of `boost::addressof(v)`.]]]]]
[[`static element_type* to_address(pointer v) noexcept;`]
[[variablelist [[Returns] [The value of `v`.]]]]]]
[endsect]
[section Free functions]
[variablelist
[[`template<class T> typename pointer_traits<T>::element_type*
to_address(const T& v) noexcept;`]
[[variablelist [[Returns] [`boost::pointer_traits<T>::to_address(v)`.]]]]]]
[[`static pointer pointer_to(`['see below] `v) noexcept;`]
[[variablelist
[[Remark]
[If `element_type` is a void type, the type of `v` is unspecified;
otherwise, it is `element_type&`.]]
[[Returns]
[The result of `std::addressof(v)`.]]]]]
[[`static element_type* to_address(pointer v) noexcept;`]
[[variablelist [[Returns] [The value of `v`.]]]]]]
[endsect]

View File

@@ -19,11 +19,11 @@
// http://www.boost.org/LICENSE_1_0.txt
//
#include <boost/core/no_exceptions_support.hpp>
#include <iterator>
#include <boost/assert.hpp>
#include <boost/current_function.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <iostream>
#include <iterator>
#include <cstring>
#include <cstddef>
@@ -115,7 +115,7 @@ inline const void* test_output_impl(signed char* v) { return v; }
template<class T> inline const void* test_output_impl(T volatile* v) { return const_cast<T*>(v); }
#if !defined( BOOST_NO_CXX11_NULLPTR )
inline const void* test_output_impl(std::nullptr_t) { return nullptr; }
inline const void* test_output_impl(std::nullptr_t v) { return v; }
#endif
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,

View File

@@ -23,8 +23,8 @@ struct pointer_traits;
namespace detail {
template<class U>
inline typename boost::pointer_traits<U>::element_type*
ptr_traits_address(const U& v) BOOST_NOEXCEPT
static typename boost::pointer_traits<U>::element_type*
ptr_traits_address(U v) BOOST_NOEXCEPT
{
return boost::pointer_traits<U>::to_address(v);
}
@@ -40,7 +40,7 @@ struct pointer_traits
typedef typename std::pointer_traits<T>::template rebind<U> type;
};
static typename std::pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT {
to_address(T v) BOOST_NOEXCEPT {
return detail::ptr_traits_address(v.operator->());
}
};
@@ -211,7 +211,7 @@ struct pointer_traits {
pointer_to(typename detail::ptr_traits_value<element_type>::type& v) {
return pointer::pointer_to(v);
}
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
static element_type* to_address(pointer v) BOOST_NOEXCEPT {
return detail::ptr_traits_address(v.operator->());
}
};
@@ -239,20 +239,6 @@ struct pointer_traits<T*> {
};
#endif
template<class T>
inline typename pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT
{
return pointer_traits<T>::to_address(v);
}
template<class T>
inline T*
to_address(T* v) BOOST_NOEXCEPT
{
return v;
}
} /* boost */
#endif

View File

@@ -0,0 +1,43 @@
/*
* Copyright Andrey Semashev 2007 - 2013.
* 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)
*/
/*!
* \file empty_deleter.hpp
* \author Andrey Semashev
* \date 22.04.2007
*
* This header contains an \c empty_deleter implementation. This is an empty
* function object that receives a pointer and does nothing with it.
* Such empty deletion strategy may be convenient, for example, when
* constructing <tt>shared_ptr</tt>s that point to some object that should not be
* deleted (i.e. a variable on the stack or some global singleton, like <tt>std::cout</tt>).
*/
#ifndef BOOST_UTILITY_EMPTY_DELETER_HPP
#define BOOST_UTILITY_EMPTY_DELETER_HPP
#include <boost/config.hpp>
#include <boost/core/null_deleter.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if defined(__GNUC__)
#pragma message "This header is deprecated, use boost/core/null_deleter.hpp instead."
#elif defined(_MSC_VER)
#pragma message("This header is deprecated, use boost/core/null_deleter.hpp instead.")
#endif
namespace boost {
//! A deprecated name for \c null_deleter
typedef null_deleter empty_deleter;
} // namespace boost
#endif // BOOST_UTILITY_EMPTY_DELETER_HPP

View File

@@ -1,6 +1,6 @@
# Boost.Core Library test Jamfile
#
# Copyright (c) 2014, 2017 Peter Dimov
# Copyright (c) 2014 Peter Dimov
#
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at
@@ -9,10 +9,6 @@
import modules ;
import testing ;
# quick test (for CI)
run quick.cpp ;
# full test suite
run addressof_test.cpp ;
run addressof_test2.cpp ;
run addressof_np_test.cpp ;
@@ -120,7 +116,6 @@ run pointer_traits_element_type_test.cpp ;
run pointer_traits_difference_type_test.cpp ;
run pointer_traits_rebind_test.cpp ;
run pointer_traits_pointer_to_test.cpp ;
run to_address_test.cpp ;
use-project /boost/core/swap : ./swap ;
build-project ./swap ;

View File

@@ -21,44 +21,6 @@ private:
T value_;
};
template<class T>
class special {
public:
special(T* value)
: value_(value) { }
T* get() const BOOST_NOEXCEPT {
return value_;
}
private:
T* value_;
};
namespace boost {
template<class T>
struct pointer_traits<special<T> > {
typedef special<T> pointer;
typedef T element_type;
typedef std::ptrdiff_t difference_type;
template<class U>
struct rebind_to {
typedef special<U> type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = typename rebind_to<U>::type;
#endif
template<class U>
static pointer pointer_to(U& v) BOOST_NOEXCEPT {
return pointer(&v);
}
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
return v.get();
}
};
} /* boost */
int main()
{
int i = 0;
@@ -97,35 +59,5 @@ int main()
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
{
typedef special<int> type;
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
{
typedef special<void> type;
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
{
typedef special<const int> type;
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
{
typedef pointer<special<int> > type;
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
{
typedef pointer<special<void> > type;
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
{
typedef pointer<special<const int> > type;
type p(&i);
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
}
return boost::report_errors();
}

View File

@@ -1,34 +0,0 @@
//
// quick.cpp - a quick (CI) test for Boost.Core
//
// Copyright 2017 Peter Dimov
//
// 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
//
#include <boost/core/addressof.hpp>
#include <boost/core/checked_delete.hpp>
#include <boost/core/demangle.hpp>
#include <boost/detail/iterator.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/core/explicit_operator_bool.hpp>
#include <boost/get_pointer.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/core/is_same.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/noncopyable.hpp>
#include <boost/core/null_deleter.hpp>
#include <boost/core/pointer_traits.hpp>
#include <boost/ref.hpp>
#include <boost/core/scoped_enum.hpp>
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/core/typeinfo.hpp>
#include <boost/core/underlying_type.hpp>
#include <boost/visit_each.hpp>
int main()
{
}

View File

@@ -1,131 +0,0 @@
/*
Copyright 2017 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/core/pointer_traits.hpp>
#include <boost/core/lightweight_test.hpp>
template<class T>
class pointer {
public:
typedef typename boost::pointer_traits<T>::element_type element_type;
pointer(T value)
: value_(value) { }
T operator->() const BOOST_NOEXCEPT {
return value_;
}
private:
T value_;
};
template<class T>
class special {
public:
special(T* value)
: value_(value) { }
T* get() const BOOST_NOEXCEPT {
return value_;
}
private:
T* value_;
};
namespace boost {
template<class T>
struct pointer_traits<special<T> > {
typedef special<T> pointer;
typedef T element_type;
typedef std::ptrdiff_t difference_type;
template<class U>
struct rebind_to {
typedef special<U> type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = typename rebind_to<U>::type;
#endif
template<class U>
static pointer pointer_to(U& v) BOOST_NOEXCEPT {
return pointer(&v);
}
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
return v.get();
}
};
} /* boost */
int main()
{
int i = 0;
{
typedef int* type;
type p = &i;
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<int*> type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<pointer<int*> > type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef void* type;
type p = &i;
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<void*> type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef const int* type;
type p = &i;
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<const int*> type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef special<int> type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef special<void> type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef special<const int> type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<special<int> > type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<special<void> > type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
{
typedef pointer<special<const int> > type;
type p(&i);
BOOST_TEST(boost::to_address(p) == &i);
}
return boost::report_errors();
}