Skip to content

Commit

Permalink
Merge pull request #152 from Morwenn/develop
Browse files Browse the repository at this point in the history
Release 1.5.0
  • Loading branch information
Morwenn committed Aug 17, 2019
2 parents e71ed9d + 5760b4d commit da5aa9f
Show file tree
Hide file tree
Showing 47 changed files with 1,893 additions and 867 deletions.
11 changes: 10 additions & 1 deletion .travis.yml
Expand Up @@ -173,7 +173,7 @@ matrix:
after_success:
- conan remote add bintray https://api.bintray.com/conan/morwenn/cpp-sort
- conan user -r bintray -p ${CONAN_PASSWORD} morwenn
- conan upload --all -r bintray cpp-sort/1.4.0@morwenn/stable
- conan upload --all -r bintray cpp-sort/1.5.0@morwenn/stable

before_install:
- if [[ $TRAVIS_OS_NAME = "linux" && $CXX = "clang++" ]]; then
Expand Down Expand Up @@ -210,15 +210,24 @@ script:
else
travis_wait ctest -C ${BUILD_TYPE} --output-on-failure;
fi
- if [[ $TRAVIS_OS_NAME = "windows" ]]; then
cd ..;
fi

after_success:
- if [[ $TRAVIS_OS_NAME = "windows" ]]; then
cd build;
fi
- if [[ $ENABLE_COVERAGE = true ]]; then
make gcov;
make lcov;
bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports";
fi

after_failure:
- if [[ $TRAVIS_OS_NAME = "windows" ]]; then
cd build;
fi
- if [[ $USE_VALGRIND = true ]]; then
find ./Testing/Temporary -type f -name "MemoryChecker.*.log" -size +1300c | xargs cat;
fi
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(cpp-sort VERSION 1.4.0 LANGUAGES CXX)
project(cpp-sort VERSION 1.5.0 LANGUAGES CXX)

include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
Expand Down Expand Up @@ -48,11 +48,16 @@ configure_package_config_file(
${CMAKE_INSTALL_LIBDIR}/cmake/cpp-sort
)

# Bypass automatic architeture check introduced by CMake,
# use the ARCH_INDEPENDENT option for this in the future
set(CPPSORT_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
unset(CMAKE_SIZEOF_VOID_P)
write_basic_package_version_file(
${CMAKE_BINARY_DIR}/cmake/cpp-sort-config-version.cmake
COMPATIBILITY
SameMajorVersion
)
set(CMAKE_SIZEOF_VOID_P ${CPPSORT_SIZEOF_VOID_P})

install(
FILES
Expand Down
3 changes: 2 additions & 1 deletion README.md
@@ -1,4 +1,5 @@
[![Latest Release](https://img.shields.io/badge/release-cpp--sort%2F1.4.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases)
[![Latest Release](https://img.shields.io/badge/release-cpp--sort%2F1.5.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases)
[![Conan Package](https://img.shields.io/badge/conan-1.5.0-blue.svg)](https://bintray.com/morwenn/cpp-sort/cpp-sort%3Amorwenn)
[![Build Status](https://travis-ci.org/Morwenn/cpp-sort.svg?branch=master)](https://travis-ci.org/Morwenn/cpp-sort)
[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/master/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort)
Expand Down
18 changes: 9 additions & 9 deletions conanfile.py
@@ -1,25 +1,25 @@
from conans import ConanFile
from conans import CMake, ConanFile


class CppSortConan(ConanFile):
name = "cpp-sort"
version = "1.4.0"
settings = "compiler"
version = "1.5.0"
license = "https://github.com/Morwenn/cpp-sort/blob/master/license.txt"
url = "https://github.com/Morwenn/cpp-sort"
author = "Morwenn <morwenn29@hotmail.fr>"
description = "Additional sorting algorithms & related tools"
exports_sources = "include/*"
exports_sources = ("include/*", "CMakeLists.txt", "cmake/*")
exports = "license.txt"
generators = "cmake", "txt"
no_copy_source = True

def configure(self):
if self.settings.compiler == "Visual Studio":
raise Exception("Visual Studio is not supported.")

def package(self):
cmake = CMake(self)
cmake.definitions["BUILD_TESTING"] = "OFF"
cmake.configure()
cmake.install()

self.copy("license*", dst="licenses", ignore_case=True, keep_path=False)
self.copy(pattern="*", src="include", dst="include")

def package_id(self):
self.info.header_only()
66 changes: 39 additions & 27 deletions include/cpp-sort/adapters/container_aware_adapter.h
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2018 Morwenn
* Copyright (c) 2016-2019 Morwenn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -33,6 +33,7 @@
#include <cpp-sort/sort.h>
#include <cpp-sort/sorter_facade.h>
#include <cpp-sort/sorter_traits.h>
#include <cpp-sort/utility/adapter_storage.h>
#include "../detail/projection_compare.h"
#include "../detail/type_traits.h"

Expand Down Expand Up @@ -108,8 +109,15 @@ namespace cppsort
{};

template<typename Sorter>
struct container_aware_adapter_base
struct container_aware_adapter_base:
utility::adapter_storage<Sorter>
{
container_aware_adapter_base() = default;

constexpr explicit container_aware_adapter_base(Sorter&& sorter):
utility::adapter_storage<Sorter>(std::move(sorter))
{}

template<
bool Stability = false,
typename Iterable
Expand All @@ -120,11 +128,11 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable))
decltype(detail::adl_despair{}(this->get(), iterable))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable);
return detail::adl_despair{}(this->get(), iterable);
}

template<
Expand All @@ -137,11 +145,11 @@ namespace cppsort
conditional_t<
Stability,
cppsort::is_stable<Sorter(Iterable&)>,
decltype(cppsort::sort(Sorter{}, iterable))
decltype(cppsort::sort(this->get(), iterable))
>
>
{
return cppsort::sort(Sorter{}, iterable);
return cppsort::sort(this->get(), iterable);
}

template<
Expand All @@ -155,11 +163,11 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable, std::move(compare)))
decltype(detail::adl_despair{}(this->get(), iterable, std::move(compare)))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable, std::move(compare));
return detail::adl_despair{}(this->get(), iterable, std::move(compare));
}

template<
Expand All @@ -174,11 +182,11 @@ namespace cppsort
conditional_t<
Stability,
cppsort::is_stable<Sorter(Iterable&, Compare)>,
decltype(cppsort::sort(Sorter{}, iterable, std::move(compare)))
decltype(cppsort::sort(this->get(), iterable, std::move(compare)))
>
>
{
return cppsort::sort(Sorter{}, iterable, std::move(compare));
return cppsort::sort(this->get(), iterable, std::move(compare));
}

template<
Expand All @@ -193,11 +201,11 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable, std::move(projection)))
decltype(detail::adl_despair{}(this->get(), iterable, std::move(projection)))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable, std::move(projection));
return detail::adl_despair{}(this->get(), iterable, std::move(projection));
}

template<
Expand All @@ -212,12 +220,12 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable,
decltype(detail::adl_despair{}(this->get(), iterable,
std::less<>{}, std::move(projection)))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable,
return detail::adl_despair{}(this->get(), iterable,
std::less<>{}, std::move(projection));
}

Expand All @@ -238,13 +246,13 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable,
decltype(detail::adl_despair{}(this->get(), iterable,
detail::make_projection_compare(std::less<>{},
std::move(projection))))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable,
return detail::adl_despair{}(this->get(), iterable,
detail::make_projection_compare(std::less<>{},
std::move(projection)));
}
Expand All @@ -267,11 +275,11 @@ namespace cppsort
conditional_t<
Stability,
cppsort::is_stable<Sorter(Iterable&, Projection)>,
decltype(cppsort::sort(Sorter{}, iterable, std::move(projection)))
decltype(cppsort::sort(this->get(), iterable, std::move(projection)))
>
>
{
return cppsort::sort(Sorter{}, iterable, std::move(projection));
return cppsort::sort(this->get(), iterable, std::move(projection));
}

template<
Expand All @@ -286,12 +294,12 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable,
decltype(detail::adl_despair{}(this->get(), iterable,
std::move(compare), std::move(projection)))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable,
return detail::adl_despair{}(this->get(), iterable,
std::move(compare), std::move(projection));
}

Expand All @@ -312,13 +320,13 @@ namespace cppsort
conditional_t<
Stability,
std::false_type,
decltype(detail::adl_despair{}(Sorter{}, iterable,
decltype(detail::adl_despair{}(this->get(), iterable,
detail::make_projection_compare(std::move(compare),
std::move(projection))))
>
>
{
return detail::adl_despair{}(Sorter{}, iterable,
return detail::adl_despair{}(this->get(), iterable,
detail::make_projection_compare(std::move(compare),
std::move(projection)));
}
Expand All @@ -340,12 +348,12 @@ namespace cppsort
conditional_t<
Stability,
cppsort::is_stable<Sorter(Iterable&, Compare, Projection)>,
decltype(cppsort::sort(Sorter{}, iterable,
decltype(cppsort::sort(this->get(), iterable,
std::move(compare), std::move(projection)))
>
>
{
return cppsort::sort(Sorter{}, iterable,
return cppsort::sort(this->get(), iterable,
std::move(compare), std::move(projection));
}
};
Expand All @@ -354,12 +362,16 @@ namespace cppsort
template<typename Sorter>
struct container_aware_adapter:
detail::container_aware_adapter_base<Sorter>,
sorter_facade_fptr<container_aware_adapter<Sorter>>
detail::sorter_facade_fptr<
container_aware_adapter<Sorter>,
std::is_empty<Sorter>::value
>
{
container_aware_adapter() = default;

// Automatic deduction guide
constexpr explicit container_aware_adapter(Sorter) noexcept {}
constexpr explicit container_aware_adapter(Sorter sorter):
detail::container_aware_adapter_base<Sorter>(std::move(sorter))
{}
};

////////////////////////////////////////////////////////////
Expand Down

0 comments on commit da5aa9f

Please sign in to comment.