C++ STL: set_difference()

Usage:

set_difference(minuend.begin(), minuend.end(),
               subtracter.begin(), subtracter.end(), difference.begin());

The source code of set_difference() from <stl_algo.h>:

/**
*  @brief Return the difference of two sorted ranges.
*  @ingroup set_algorithms
*  @param  __first1  Start of first range.
*  @param  __last1   End of first range.
*  @param  __first2  Start of second range.
*  @param  __last2   End of second range.
*  @return  End of the output range.
*  @ingroup set_algorithms
*
*  This operation iterates over both ranges, copying elements present in
*  the first range but not the second in order to the output range.
*  Iterators increment for each range.  When the current element of the
*  first range is less than the second, that element is copied and the
*  iterator advances.  If the current element of the second range is less,
*  the iterator advances, but no element is copied.  If an element is
*  contained in both ranges, no elements are copied and both ranges
*  advance.  The output range may not overlap either input range.
*/
template<typename _InputIterator1, typename _InputIterator2,
        typename _OutputIterator>
inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
               _InputIterator2 __first2, _InputIterator2 __last2,
               _OutputIterator __result) {
    // concept requirements
    __glibcxx_function_requires(_InputIteratorConcept < _InputIterator1 >)
    __glibcxx_function_requires(_InputIteratorConcept < _InputIterator2 >)
    __glibcxx_function_requires(_OutputIteratorConcept < _OutputIterator,
                                typename iterator_traits<_InputIterator1>::value_type >)
    __glibcxx_function_requires(_LessThanOpConcept <
                                typename iterator_traits<_InputIterator1>::value_type,
                                typename iterator_traits<_InputIterator2>::value_type >)
    __glibcxx_function_requires(_LessThanOpConcept <
                                typename iterator_traits<_InputIterator2>::value_type,
                                typename iterator_traits<_InputIterator1>::value_type >)
    __glibcxx_requires_sorted_set(__first1, __last1, __first2);
    __glibcxx_requires_sorted_set(__first2, __last2, __first1);

    return _GLIBCXX_STD_A::__set_difference(__first1, __last1,
                                            __first2, __last2, __result,
                                            __gnu_cxx::__ops::__iter_less_iter());
}

The source code of __set_difference() from <stl_algo.h>:

template<typename _InputIterator1, typename _InputIterator2,
        typename _OutputIterator,
        typename _Compare>
_OutputIterator
__set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
                 _InputIterator2 __first2, _InputIterator2 __last2,
                 _OutputIterator __result, _Compare __comp) {
    while (__first1 != __last1 && __first2 != __last2)
        if (__comp(__first1, __first2)) {
            *__result = *__first1;
            ++__first1;
            ++__result;
        }
        else if (__comp(__first2, __first1))
            ++__first2;
        else {
            ++__first1;
            ++__first2;
        }
    return std::copy(__first1, __last1, __result);
}

Git Command

 git init:初始化Git仓库

 git add filename:将文件放入暂存区域

 git commit -m "explanation":将暂存区域文件提交至Git仓库

 git status:查看当前状态

 git log [--decorate --oneline --graph --all]:查看提交记录

 git reset [--mixed(default)/soft/hard] HEAD[~*n]/Git_ID:回滚文件(默认从Git仓库至暂存区域)

 git checkout [filename]:回滚文件(从暂存区域至工作区域)

 git diff:比较工作区域与暂存区域

 git diff HEAD[~*n]/Git_ID:比较工作区域与快照

 git diff --cached [HEAD[~*n]/Git_ID]:比较暂存区域与快照

 git diff HEAD[~*n]/Git_ID1 HEAD[~*n]/Git_ID2:比较两个快照

 git commit --amend:更改最后一次提交

 git mv oldname newname:重命名文件

 git branch branchname:创建分支

 git checkout [-b] branchname:切换分支
 
 git merge branchname:合并分支至master

 git branch -d branchname:删除分支

 git clone url:克隆云端Git仓库至本地

 git push --set-upstream origin master:推送本地Git仓库至云端 

Oracle PL/SQL Grammar

Procedure:

create [or replace] procedure pname[(parameter p_pname)]
is
[......]
begin
[......]
[exception]
end [pname];
/

Function:

create [or replace] function fname[(parameter p_pname)]
return datatype
is
[......]
begin
[......]
[exception]
end [fname];
/

Trigger:

create [or replace] trigger tname
before/after insert or update[of column] or delete on table
[for each row]
[declare]
begin
[......]
[exception]
end;
/