Last active
September 19, 2018 20:56
-
-
Save cor3ntin/251ff29a71c8fcf7980c3786a0adb430 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <stl2/concepts.hpp> | |
#include <stl2/iterator.hpp> | |
#include <stl2/ranges.hpp> | |
#include <vector> | |
#include <list> | |
#include <string> | |
namespace std::experimental::ranges { | |
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> | |
class basic_string : public std::basic_string<charT, traits, Allocator> { | |
using __b = std::basic_string<charT, traits, Allocator>; | |
public: | |
using __b::basic_string; | |
template <InputRange Rng> | |
requires ConvertibleTo<iter_value_t<iterator_t<Rng>>, charT> | |
basic_string(Rng && rng, const Allocator & a = {}) | |
: __b(begin(rng),end(rng), a) {} | |
}; | |
template <typename T, typename Allocator = std::allocator<T>> | |
class vector : public std::vector<T, Allocator> { | |
using __v = std::vector<T,Allocator>; | |
public: | |
using __v::vector; | |
template <InputRange Rng> | |
requires ConvertibleTo<iter_value_t<iterator_t<Rng>>, T> | |
vector(Rng && rng, const Allocator & a = {}) | |
: __v(begin(rng),end(rng), a) {} | |
}; | |
template <InputRange Rng, typename Allocator = std::allocator<iter_value_t <iterator_t< Rng>>>> | |
vector(Rng b, Allocator a = {}) -> vector<iter_value_t<iterator_t<Rng>>, Allocator>; | |
template<InputRange Rng, typename Allocator = std::allocator<iter_value_t <iterator_t< Rng>>>> | |
basic_string(Rng b, Allocator a = {}) -> basic_string<iter_value_t<iterator_t<Rng>>, char_traits<iter_value_t<iterator_t<Rng>>>, Allocator>; | |
using string = basic_string<char>; | |
using u16string = basic_string<char16_t>; | |
using u32string = basic_string<char32_t>; | |
using wstring = basic_string<wchar_t>; | |
} | |
namespace std2 = std::experimental::ranges; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment