View | Details | Raw Unified | Return to bug 2943
Collapse All | Expand All

(-)a/src/core/model/ptr.h (-174 / +9 lines)
 Lines 212-348    Link Here 
212
 *
212
 *
213
 * These methods work for any class \c T.
213
 * These methods work for any class \c T.
214
 *
214
 *
215
 * \tparam T  \explicit The type of class object to create.
216
 * \tparam Args \deduced The types of the constructor arguments.
217
 * \return A Ptr to the newly created \c T.
218
 *
215
 * \see CreateObject for methods to create derivatives of ns3::Object
219
 * \see CreateObject for methods to create derivatives of ns3::Object
216
 */
220
 */
217
/** @{ */
221
template<typename T, typename... Args>
218
/**
222
Ptr<T> Create(Args&&... args);
219
 * \tparam T \explicit The type of class object to create.
220
 * \return A Ptr to the newly created \c T.
221
 */
222
template <typename T>
223
Ptr<T> Create (void);
224
225
/**
226
 * \tparam T  \explicit The type of class object to create.
227
 * \tparam T1 \deduced The type of the first constructor argument.
228
 * \param  [in] a1 The first constructor argument.
229
 * \return A Ptr to the newly created \c T.
230
 */
231
template <typename T,
232
          typename T1>
233
Ptr<T> Create (T1 a1);
234
235
/**
236
 * \tparam T  \explicit The type of class object to create.
237
 * \tparam T1 \deduced The type of the first constructor argument.
238
 * \tparam T2 \deduced The type of the second constructor argument.
239
 * \param  [in] a1 The first constructor argument.
240
 * \param  [in] a2 The second constructor argument.
241
 * \return A Ptr to the newly created \c T.
242
 */
243
template <typename T,
244
          typename T1, typename T2>
245
Ptr<T> Create (T1 a1, T2 a2);
246
247
/**
248
 * \tparam T  \explicit The type of class object to create.
249
 * \tparam T1 \deduced The type of the first constructor argument.
250
 * \tparam T2 \deduced The type of the second constructor argument.
251
 * \tparam T3 \deduced The type of the third constructor argument.
252
 * \param  [in] a1 The first constructor argument.
253
 * \param  [in] a2 The second constructor argument.
254
 * \param  [in] a3 The third constructor argument.
255
 * \return A Ptr to the newly created \c T.
256
 */
257
template <typename T,
258
          typename T1, typename T2,
259
          typename T3>
260
Ptr<T> Create (T1 a1, T2 a2, T3 a3);
261
262
/**
263
 * \tparam T  \explicit The type of class object to create.
264
 * \tparam T1 \deduced The type of the first constructor argument.
265
 * \tparam T2 \deduced The type of the second constructor argument.
266
 * \tparam T3 \deduced The type of the third constructor argument.
267
 * \tparam T4 \deduced The type of the fourth constructor argument.
268
 * \param  [in] a1 The first constructor argument.
269
 * \param  [in] a2 The second constructor argument.
270
 * \param  [in] a3 The third constructor argument.
271
 * \param  [in] a4 The fourth constructor argument.
272
 * \return A Ptr to the newly created \c T.
273
 */
274
template <typename T,
275
          typename T1, typename T2,
276
          typename T3, typename T4>
277
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4);
278
279
/**
280
 * \tparam T  \explicit The type of class object to create.
281
 * \tparam T1 \deduced The type of the first constructor argument.
282
 * \tparam T2 \deduced The type of the second constructor argument.
283
 * \tparam T3 \deduced The type of the third constructor argument.
284
 * \tparam T4 \deduced The type of the fourth constructor argument.
285
 * \tparam T5 \deduced The type of the fifth constructor argument.
286
 * \param  [in] a1 The first constructor argument.
287
 * \param  [in] a2 The second constructor argument.
288
 * \param  [in] a3 The third constructor argument.
289
 * \param  [in] a4 The fourth constructor argument.
290
 * \param  [in] a5 The fifth constructor argument.
291
 * \return A Ptr to the newly created \c T.
292
 */
293
template <typename T,
294
          typename T1, typename T2,
295
          typename T3, typename T4,
296
          typename T5>
297
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
298
299
/**
300
 * \tparam T  \explicit The type of class object to create.
301
 * \tparam T1 \deduced The type of the first constructor argument.
302
 * \tparam T2 \deduced The type of the second constructor argument.
303
 * \tparam T3 \deduced The type of the third constructor argument.
304
 * \tparam T4 \deduced The type of the fourth constructor argument.
305
 * \tparam T5 \deduced The type of the fifth constructor argument.
306
 * \tparam T6 \deduced The type of the sixth constructor argument.
307
 * \param  [in] a1 The first constructor argument.
308
 * \param  [in] a2 The second constructor argument.
309
 * \param  [in] a3 The third constructor argument.
310
 * \param  [in] a4 The fourth constructor argument.
311
 * \param  [in] a5 The fifth constructor argument.
312
 * \param  [in] a6 The sixth constructor argument.
313
 * \return A Ptr to the newly created \c T.
314
 */
315
template <typename T,
316
          typename T1, typename T2,
317
          typename T3, typename T4,
318
          typename T5, typename T6>
319
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
320
321
/**
322
 * \tparam T  \explicit The type of class object to create.
323
 * \tparam T1 \deduced The type of the first constructor argument.
324
 * \tparam T2 \deduced The type of the second constructor argument.
325
 * \tparam T3 \deduced The type of the third constructor argument.
326
 * \tparam T4 \deduced The type of the fourth constructor argument.
327
 * \tparam T5 \deduced The type of the fifth constructor argument.
328
 * \tparam T6 \deduced The type of the sixth constructor argument.
329
 * \tparam T7 \deduced The type of the seventh constructor argument.
330
 * \param  [in] a1 The first constructor argument.
331
 * \param  [in] a2 The second constructor argument.
332
 * \param  [in] a3 The third constructor argument.
333
 * \param  [in] a4 The fourth constructor argument.
334
 * \param  [in] a5 The fifth constructor argument.
335
 * \param  [in] a6 The sixth constructor argument.
336
 * \param  [in] a7 The seventh constructor argument.
337
 * \return A Ptr to the newly created \c T.
338
 */
339
template <typename T,
340
          typename T1, typename T2,
341
          typename T3, typename T4,
342
          typename T5, typename T6,
343
          typename T7>
344
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7);
345
/** @}*/
346
223
347
/**
224
/**
348
 * \ingroup ptr
225
 * \ingroup ptr
 Lines 512-563    Link Here 
512
 *  friend non-member function implementations
389
 *  friend non-member function implementations
513
 ************************************************/
390
 ************************************************/
514
391
515
template <typename T>
392
template<typename T, typename... Args>
516
Ptr<T> Create (void)
393
Ptr<T> Create(Args&&... args)
517
{
518
  return Ptr<T> (new T (), false);
519
}
520
521
template <typename T, typename T1>
522
Ptr<T> Create (T1 a1)
523
{
524
  return Ptr<T> (new T (a1), false);
525
}
526
527
template <typename T, typename T1, typename T2>
528
Ptr<T> Create (T1 a1, T2 a2)
529
{
530
  return Ptr<T> (new T (a1, a2), false);
531
}
532
533
template <typename T, typename T1, typename T2, typename T3>
534
Ptr<T> Create (T1 a1, T2 a2, T3 a3)
535
{
394
{
536
  return Ptr<T> (new T (a1, a2, a3), false);
395
  return Ptr<T> (new T(std::forward<Args>(args)...), false);
537
}
538
539
template <typename T, typename T1, typename T2, typename T3, typename T4>
540
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4)
541
{
542
  return Ptr<T> (new T (a1, a2, a3, a4), false);
543
}
544
545
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
546
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
547
{
548
  return Ptr<T> (new T (a1, a2, a3, a4, a5), false);
549
}
550
551
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
552
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
553
{
554
  return Ptr<T> (new T (a1, a2, a3, a4, a5, a6), false);
555
}
556
557
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
558
Ptr<T> Create (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
559
{
560
  return Ptr<T> (new T (a1, a2, a3, a4, a5, a6, a7), false);
561
}
396
}
562
397
563
template <typename U>
398
template <typename U>

Return to bug 2943