XLL+ Class Library (6.3)

CXlOper::FromVector2() Example

CopyC++
#include <algorithm> 
 
// Function:    XlOperFromVectorEx 
// Purpose:     Returns a sorted vector 
 
//{{XLP_SRC(XlOperFromVectorEx) 
    // NOTE - the FunctionWizard will add and remove mapping code here. 
    //    DO NOT EDIT what you see in these blocks of generated code!
IMPLEMENT_XLLFN3(XlOperFromVectorEx, XlOperFromVectorEx_4, 
    XlOperFromVectorEx_12, "RP", "UQ", L"XlOperFromVectorEx", 0, L"Input", 0, 
    L"Demo Functions", 0, L"Returns a sorted vector", 0, L"Vector of numbers\0",
    0, 0, L"{XlOperFromVectorEx,,,Returns a sorted vector,Demo Functions,1,128"
    L",U,{{0,{Input,Double,2097162,,Vector of numbers,,{{{0,},{,}}},,}}},{},3,"
    L",0,0}", 1)
CXlOper* XlOperFromVectorEx_Impl(CXlOper&, const CXlOper*);

extern "C" __declspec(dllexport)
LPXLOPER12 XlOperFromVectorEx_12(LPXLOPER12 Input)
{
    XLL_FIX_STATE;
    CXlOper xloResult, Input__port(Input);
    try {
        CXlStructuredExceptionHandler _seh_;
        xloResult.HandleResult(XlOperFromVectorEx_Impl(xloResult, &Input__port));
    }
    catch(const CXlRuntimeException& ex) {
        CXllApp::Instance()->DisplayException(xloResult, ex);
    }
    return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 XlOperFromVectorEx_4(LPXLOPER4 Input)
{
    XLL_FIX_STATE;
    CXlOper xloResult, Input__port(Input);
    try {
        CXlStructuredExceptionHandler _seh_;
        xloResult.HandleResult(XlOperFromVectorEx_Impl(xloResult, &Input__port));
    }
    catch(const CXlRuntimeException& ex) {
        CXllApp::Instance()->DisplayException(xloResult, ex);
    }
    return xloResult.Ret4();
}

CXlOper* XlOperFromVectorEx_Impl(CXlOper& xloResult, const CXlOper* Input)
{
    // Input buffers 
    std::vector<double> vecInput;
    // Validate and translate inputs
    XlReadVector(*Input, vecInput, L"Input", XLA_TRUNC_ONEMPTY|XLA_TRUNC_ONBLANK
        |XLA_BOUND_UBOUND_AUTO, 0, 0);
    // End of generated code 
//}}XLP_SRC

    std::sort(vecInput.begin(), vecInput.end());
    xloResult.FromVector2(vecInput);
    return xloResult.Ret();
}

Uses

CXlOper::FromVector2