libcxx initial import
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <iterator>
|
||||
|
||||
// insert_iterator
|
||||
|
||||
// Test nested types and data members:
|
||||
|
||||
// template <InsertionContainer Cont>
|
||||
// class insert_iterator {
|
||||
// protected:
|
||||
// Cont* container;
|
||||
// Cont::iterator iter;
|
||||
// public:
|
||||
// typedef Cont container_type;
|
||||
// typedef void value_type;
|
||||
// typedef void difference_type;
|
||||
// typedef insert_iterator<Cont>& reference;
|
||||
// typedef void pointer;
|
||||
// };
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
template <class C>
|
||||
struct find_members
|
||||
: private std::insert_iterator<C>
|
||||
{
|
||||
explicit find_members(C& c) : std::insert_iterator<C>(c, c.begin()) {}
|
||||
void test()
|
||||
{
|
||||
this->container = 0;
|
||||
this->iter == this->iter;
|
||||
}
|
||||
};
|
||||
|
||||
template <class C>
|
||||
void
|
||||
test()
|
||||
{
|
||||
typedef std::insert_iterator<C> R;
|
||||
C c;
|
||||
find_members<C> q(c);
|
||||
q.test();
|
||||
static_assert((std::is_same<typename R::container_type, C>::value), "");
|
||||
static_assert((std::is_same<typename R::value_type, void>::value), "");
|
||||
static_assert((std::is_same<typename R::difference_type, void>::value), "");
|
||||
static_assert((std::is_same<typename R::reference, R&>::value), "");
|
||||
static_assert((std::is_same<typename R::pointer, void>::value), "");
|
||||
static_assert((std::is_same<typename R::iterator_category, std::output_iterator_tag>::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<std::vector<int> >();
|
||||
}
|
||||
Reference in New Issue
Block a user