ext/ preprocessor/ seq/ insert.bi

This file is part of the <ext/Preprocessor> library API, and can be directly included by user programs.

Summary
ext/ preprocessor/ seq/ insert.biThis file is part of the <ext/Preprocessor> library API, and can be directly included by user programs.
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group Copyright © 2002, Paul Mensonides
Macros
fbextPP_SeqInsertInserts an element before a certain position in a sequence.

License

Copyright © 2009, FreeBASIC Extended Library Development Group Copyright © 2002, Paul Mensonides

Distributed under the Boost Software License, Version 1.0.  See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License

Macros

fbextPP_SeqInsert

# define fbextPP_SeqInsert(
   seq,
   i,
   elem
) FBEXT_PP_CAT(FBEXT_PP_IF(i, FBEXT_PP_SEQ_FIRSTN, fbextPP_TupleEat__2)(i, seq)(elem), FBEXT_PP_SEQ_RESTN(i, seq))

Inserts an element before a certain position in a sequence.

Parameters

seqA sequence.
iThe zero-based position in the sequence to insert the element.
elemThe element to insert.

Returns

The new sequence.

Description

Given a sequence (a)(b)(c)(d) and i 2, this macro willl expand to (a)(b)(x)(c)(d).

# define fbextPP_SeqInsert(
   seq,
   i,
   elem
) FBEXT_PP_CAT(FBEXT_PP_IF(i, FBEXT_PP_SEQ_FIRSTN, fbextPP_TupleEat__2)(i, seq)(elem), FBEXT_PP_SEQ_RESTN(i, seq))
Inserts an element before a certain position in a sequence.