template<typename TChar, typename TAllocator>
struct alib::boxing::FAppend< TChar, TAllocator >
Implementations of this box-function write the content of the data stored in the box to the given AString object.
A default implementation is registered. This writes out the raw value of the first uinteger field of the boxes' Placeholder in hexadecimal format. For pointer types, such raw value reflects the memory address of the boxable. In debug-compilations, in addition, the type name of the boxed value is written.
Templated static method Appendable can be used to avoid implementations for those mapped types that specialized type-traits functor AppendableTraits that makes values of the type usable with Append(const TAppendable&) already.
- Note
- This is a templated (!) function declaration that defines three different box-functions at once, namely FAppend<character>, FAppend<complementChar> and FAppend<strangeChar>.
This box-function is usually invoked only indirectly, by "appending" a box to an AString, as shown here:
Box box= 42;
AString text;
text << "The answer is: "; // appends a string literal
text << box; // translates to: box.Call<FAppend<character>>( text )
- Availability
- This box-function is available only if the module ALib Strings is included in the ALib Build.
- See also
-
- Template Parameters
-
| TChar | The character type of the destination AString given with parameter target. |
| TAllocator | The allocator type, as prototyped with class Allocator. |
Definition at line 393 of file functiondecls.inl.
template<typename TChar, typename TAllocator>
template<typename TAppendable>
Static templated implementation of FAppend for boxed types which are appendable.
Once a type is made appendable by specializing type-traits functor AppendableTraits, then this static templated function can be used "as is" and registered with the corresponding mapped type.
- Note
- This method internally is provided twice, once for types boxed as pointers and one for types boxed as values, and selected using template programming.
If a type is boxed as a pointer, then TComparable has to be given as such a pointer type. For comparison, the unboxed pointers will be dereferenced. This means that it is believed that AppendableTraits is specialized for the non-pointer type. If this is not the case, then two options exist:
- Specialize functor AppendableTraits for the non-pointer type in parallel.
- Do not use this inlined implementation, but rather provide a custom one that does not dereference unboxed pointers.
- See also
- Macros
- ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE
- ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_N
- ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_W
- ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE_X
- Template Parameters
-
| TAppendable | The "appendable" mapped box type that the function is to be implemented for. |
- Parameters
-
| self | The box that the function was invoked on. |
| target | The target AString of character type TChar. |