소스 검색

Added warnings for pushConstruct methods in List.

David Piuva 7 달 전
부모
커밋
13db42a4bf
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      Source/DFPSR/collection/List.h

+ 4 - 0
Source/DFPSR/collection/List.h

@@ -230,6 +230,8 @@ public:
 	}
 	// Side-effect: Pushes a new element constructed using the given arguments.
 	//   Warning! Reallocation may invalidate old pointers and references to elements in the replaced buffer.
+	//   Warning! Do not pass an element in the list as an argument to the constructor,
+	//     because reallocating will move the data from that location before being sent to the constructor.
 	// Post-condition: Returns a reference to the new element in the list.
 	template<typename... ARGS>
 	T& pushConstruct(ARGS&&... args) {
@@ -240,6 +242,8 @@ public:
 	}
 	// Side-effect: Pushes a new element constructed using the given arguments.
 	//   Warning! Reallocation may invalidate old pointers and references to elements in the replaced buffer.
+	//   Warning! Do not pass an element in the list as an argument to the constructor,
+	//     because reallocating will move the data from that location before being sent to the constructor.
 	// Post-condition: Returns an index to the new element in the list.
 	template<typename... ARGS>
 	intptr_t pushConstructGetIndex(ARGS&&... args) {