Skip to content

Instantly share code, notes, and snippets.

View dexonsmith's full-sized avatar

Duncan P. N. Exon Smith dexonsmith

View GitHub Profile
@dexonsmith
dexonsmith / stl2_concepts_sort_list.txt
Created July 7, 2017 06:29
Error message for STL2 + GCC Concepts implementation: sorting a list<int>
t.cpp:6:53: error: no matching function for call to ‘sort(std::__cxx11::list<int>::iterator, std::__cxx11::list<int>::iterator)’
std::experimental::ranges::sort(l.begin(), l.end());
^
In file included from include/stl2/algorithm.hpp:90:0,
from t.cpp:3:
include/stl2/detail/algorithm/sort.hpp:31:4: note: candidate: I std::experimental::ranges::v1::sort(I, S, Comp, Proj) [with I = std::_List_iterator<int>; S = std::_List_iterator<int>; Comp = std::experimental::ranges::v1::less<void>; Proj = std::experimental::ranges::v1::identity]
I sort(I first, S sent, Comp comp = Comp{}, Proj proj = Proj{})
^~~~
include/stl2/detail/algorithm/sort.hpp:31:4: note: constraints not satisfied
In file included from include/stl2/detail/iterator/basic_iterator.hpp:23:0,
@dexonsmith
dexonsmith / library-concepts.hpp
Created July 7, 2017 07:06
A pure library-based approach to describing concepts for C++
//=============================================================================
// A pure library-based approach to describing concepts for C++.
//
// Concepts based on a selection of those in the Ranges TS as described by:
// http://en.cppreference.com/w/cpp/experimental/ranges
//
// requires inspired by hana::is_valid:
// http://boostorg.github.io/hana/index.html#tutorial-introspection-is_valid
//=============================================================================
#pragma once
@dexonsmith
dexonsmith / concepts-library-demo.cpp
Created July 8, 2017 02:04
Demo of a library-based approach to describing concepts for C++
//=============================================================================
// A pure library-based approach to describing concepts for C++.
//
// Concepts based on a selection of those in the Ranges TS as described by:
// http://en.cppreference.com/w/cpp/experimental/ranges
//
// requires inspired by hana::is_valid:
// http://boostorg.github.io/hana/index.html#tutorial-introspection-is_valid
//
// Compile with ToT Clang using: