1
2
3
4
5
6 using System.Concepts;
7
8 namespace System
9 {
10 public class BackInsertProxy<C> where C is BackInsertionSequence
11 {
12 private typedef BackInsertProxy<C> Self;
13 private typedef C.ValueType ValueType;
14
15 public inline nothrow BackInsertProxy() : c(null)
16 {
17 }
18 public inline explicit nothrow BackInsertProxy(C* c_) : c(c_)
19 {
20 }
21 public inline void operator=(const ValueType& value)
22 {
23 c->Add(value);
24 }
25 private C* c;
26 }
27
28 public class BackInsertIterator<C> where C is BackInsertionSequence
29 {
30 private typedef BackInsertIterator<C> Self;
31 private typedef BackInsertProxy<C> Proxy;
32 public typedef C.ValueType ValueType;
33 public typedef Proxy& ReferenceType;
34 public typedef Proxy* PointerType;
35
36 public inline nothrow BackInsertIterator() : proxy()
37 {
38 }
39 public inline nothrow BackInsertIterator(C& c) : proxy(&c)
40 {
41 }
42 public inline nothrow Proxy& operator*()
43 {
44 return proxy;
45 }
46 public inline nothrow Proxy* operator->()
47 {
48 return &proxy;
49 }
50 public inline nothrow Self& operator++()
51 {
52 return *this;
53 }
54 private Proxy proxy;
55 }
56
57 public nothrow BackInsertIterator<C> BackInserter<C>(C& c) where C is BackInsertionSequence
58 {
59 return BackInsertIterator<C>(c);
60 }
61 }