2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00

Simplifications for MSVC and some polishing

This commit is contained in:
Antony Polukhin
2017-10-17 22:02:31 +03:00
parent 0c0332fe97
commit a9e5e73c30
4 changed files with 16 additions and 25 deletions

View File

@@ -10,7 +10,7 @@ This C++14 library is meant for accessing structure elements by index and provid
Branches | Build | Tests coverage | More info
----------------|-------------- | -------------- |-----------
Develop: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg?branch=develop)](https://travis-ci.org/apolukhin/magic_get) [![Build status](https://ci.appveyor.com/api/projects/status/1edm74h5id8qpr2k/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/magic-get/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=develop)](https://coveralls.io/github/apolukhin/magic_get?branch=develop) | <!-- [details...](http://www.boost.org/development/tests/develop/developer/pfr.html)) -->
Master: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg?branch=master)](https://travis-ci.org/apolukhin/magic_get) [![Build status](https://ci.appveyor.com/api/projects/status/1edm74h5id8qpr2k?svg=true)](https://ci.appveyor.com/project/apolukhin/magic-get) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=master)](https://coveralls.io/github/apolukhin/magic_get?branch=master) | <!-- [details...](http://www.boost.org/development/tests/master/developer/pfr.html)) -->
Master: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg?branch=master)](https://travis-ci.org/apolukhin/magic_get) [![Build status](https://ci.appveyor.com/api/projects/status/1edm74h5id8qpr2k/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/magic-get/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=master)](https://coveralls.io/github/apolukhin/magic_get?branch=master) | <!-- [details...](http://www.boost.org/development/tests/master/developer/pfr.html)) -->
### Motivating Example #0
```c++

View File

@@ -87,14 +87,14 @@ template <class T, std::size_t Begin, std::size_t Middle>
constexpr auto detect_fields_count(size_t_<Begin>, size_t_<Middle>, long) noexcept
-> enable_if_constructible_helper_t<T, Middle>
{
constexpr std::size_t next = Middle + (Middle - Begin + 1) / 2;
return detect_fields_count<T>(size_t_<Middle>{}, size_t_<next>{}, 1L);
using next_t = size_t_<Middle + (Middle - Begin + 1) / 2>;
return detect_fields_count<T>(size_t_<Middle>{}, next_t{}, 1L);
}
template <class T, std::size_t Begin, std::size_t Middle>
constexpr std::size_t detect_fields_count(size_t_<Begin>, size_t_<Middle>, int) noexcept {
constexpr std::size_t next = (Begin + Middle) / 2;
return detect_fields_count<T>(size_t_<Begin>{}, size_t_<next>{}, 1L);
using next_t = size_t_<(Begin + Middle) / 2>;
return detect_fields_count<T>(size_t_<Begin>{}, next_t{}, 1L);
}
///////////////////// Greedy search. Templates instantiation depth is log(sizeof(T)), templates instantiation count is log(sizeof(T))*T in worst case.

View File

@@ -76,7 +76,7 @@ class offset_based_getter {
template <std::size_t idx>
static constexpr std::ptrdiff_t offset() noexcept {
constexpr tuple_of_aligned_storage_t<S> layout{};
return &sequence_tuple::get<idx>(layout).storage_[0] - &sequence_tuple::get<0>(layout).storage_[0];;
return &sequence_tuple::get<idx>(layout).storage_[0] - &sequence_tuple::get<0>(layout).storage_[0];
}
// Encapsulates offset arithmetic and reinterpret_cast

View File

@@ -2,19 +2,19 @@
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Copyright Antony Polukhin 2016-2016-2017.
# Copyright Antony Polukhin 2016-2017.
#
# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file
# and how it can be used with Boost libraries.
#
# File revision #1
# File revision #5
init:
- set BRANCH_TO_TEST=%APPVEYOR_REPO_BRANCH%
- set BOOST_REMOVE=pfr
image: Visual Studio 2017 Preview
image: Visual Studio 2017
configuration: Debug
platform: x64
@@ -22,7 +22,7 @@ platform: x64
# From this point and below code is same for all the Boost libs
###############################################################################################################
version: 1.64.{build}-{branch}
version: 1.65.{build}-{branch}
# branches to build
branches:
@@ -32,9 +32,8 @@ branches:
skip_tags: true
before_build:
# Set this to the name of the library
- set PROJECT_TO_TEST=%APPVEYOR_PROJECT_NAME%
- echo "Testing %PROJECT_TO_TEST%"
- set PATH=%PATH%;C:\\MinGW\\bin
- echo "Testing %APPVEYOR_PROJECT_NAME%"
# Cloning Boost libraries (fast nondeep cloning)
- set BOOST=C:/boost-local
- git init %BOOST%
@@ -42,19 +41,11 @@ before_build:
- git remote add --no-tags -t %BRANCH_TO_TEST% origin https://github.com/boostorg/boost.git
- git fetch --depth=1
- git checkout %BRANCH_TO_TEST%
- git submodule update --init --merge
- git submodule update --init --merge --jobs 16
- git remote set-branches --add origin %BRANCH_TO_TEST%
- git pull --recurse-submodules
- git submodule update --init
- git checkout %BRANCH_TO_TEST%
#- git submodule foreach "git reset --quiet --hard"
#- git submodule foreach "git clean -fxd"
- git reset --hard
- git clean -fxd
- git status
#- git pull --recurse-submodules # Updaes submodules to most recent version. Not required
- rm -rf %BOOST%/libs/%BOOST_REMOVE%
- mv %APPVEYOR_BUILD_FOLDER% %BOOST%/libs/%PROJECT_TO_TEST%
- set TRAVIS_BUILD_DIR=%BOOST%/libs/%PROJECT_TO_TEST%
- mv %APPVEYOR_BUILD_FOLDER% %BOOST%/libs/%APPVEYOR_PROJECT_NAME%
build_script:
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
@@ -65,7 +56,7 @@ build_script:
after_build:
before_test:
test_script:
- ..\..\..\b2.exe address-model=64 architecture=x86 cxxflags="-DBOOST_TRAVISCI_BUILD" -sBOOST_BUILD_PATH=.
- ..\..\..\b2.exe address-model=64 architecture=x86 toolset=msvc cxxflags="-DBOOST_TRAVISCI_BUILD" -sBOOST_BUILD_PATH=.
after_test:
on_success: