| OLD | NEW |
| 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_VM_LIST_H_ | 5 #ifndef SRC_VM_LIST_H_ |
| 6 #define SRC_VM_LIST_H_ | 6 #define SRC_VM_LIST_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include "src/shared/assert.h" | 10 #include "src/shared/assert.h" |
| 11 | 11 |
| 12 namespace fletch { | 12 namespace fletch { |
| 13 | 13 |
| 14 // Lists are light-weight data structures that hold a sequence of | 14 // Lists are light-weight data structures that hold a sequence of |
| 15 // contiguous elements. List never take ownership of the data their | 15 // contiguous elements. List never take ownership of the data they |
| 16 // are passed in, so as long as the data is either in a zone or | 16 // are passed in, so as long as the data is either in a zone or |
| 17 // static, lists can be safely passed by value. | 17 // static, lists can be safely passed by value. |
| 18 template<typename T> | 18 template<typename T> |
| 19 class List { | 19 class List { |
| 20 public: | 20 public: |
| 21 List() : data_(NULL), length_(0) { } | 21 List() : data_(NULL), length_(0) { } |
| 22 | 22 |
| 23 List(T* data, int length) : data_(data), length_(length) { | 23 List(T* data, int length) : data_(data), length_(length) { |
| 24 ASSERT(length >= 0); | 24 ASSERT(length >= 0); |
| 25 } | 25 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 T* data_; | 69 T* data_; |
| 70 int length_; | 70 int length_; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace fletch | 73 } // namespace fletch |
| 74 | 74 |
| 75 #endif // SRC_VM_LIST_H_ | 75 #endif // SRC_VM_LIST_H_ |
| OLD | NEW |