What changes should I implement in my templated sorter class so that it performs efficiently? I have a college assignment to implement a class called sorter, whose object is a sorted vector (the user is allowed to sort it by the method he/she desires). I have been able to implement it as following. Please review it and suggest me the changes I should make to make it efficient.

template &lt;typename T&gt;
class Sorter {
    std::vector&lt;T&gt; vector;
    int count(T* array) {
        register int i = 0;
        while (*(array + i)) {
            i++;
        }
        i--;
        return i;
    }
    void swap(T&amp; t1, T&amp; t2) {
        T temp = t1;
        t1 = t2;
        t2 = temp;
    }
    void bubbleSort() {
        for (int i = 0; i &lt; vector.size(); i++) {
            for (int j = 0; j &lt; vector.size() - 1; j++) {
                if (vector[j] &gt; vector[j + 1]) {
                    swap(vector[j], vector[j + 1]);
                }
            }
        }
    }
    std::vector&lt;T&gt; mergeSort(std::vector&lt;T&gt; vec) {
        int begin = 0;
        int end = vec.size() - 1;
        auto combine = [=](std::vector&lt;T&gt; lv, std::vector&lt;T&gt; rv) {
            std::vector&lt;T&gt; retVec;
            int i = 0;
            int j = 0;
            while (i &lt; lv.capacity() &amp;&amp; j &lt; rv.capacity()) {
                if (lv[i] &lt; rv[j]) {
                    retVec.push_back(lv[i]);
                    i++;
                }
                else {
                    retVec.push_back(rv[j]);
                    j++;
                }
            }
            while (i &lt; lv.capacity()) {
                retVec.push_back(lv[i]);
                i++;
            }
            while (j &lt; rv.capacity()) {
                retVec.push_back(rv[j]);
                j++;
            }
            return retVec;
        };
        if (vec.size() == 1) {
            return vec;
        }
        int mid = (begin + end) / 2;
        auto it = vec.begin();
        std::vector&lt;T&gt; left = mergeSort(std::vector&lt;T&gt;(it, it + mid + 1));
        std::vector&lt;T&gt; right = mergeSort(std::vector&lt;T&gt;(it + mid + 1, vec.end()));
        return combine(left, right);
    }
    void sort() {
        std::cout &lt;&lt; "Choose your option:" &lt;&lt; "\n"; 
        std::cout &lt;&lt; "1. bubblesort" &lt;&lt; "\n";
        std::cout &lt;&lt; "2. mergesort" &lt;&lt; "\n";
        int op = 2;
        //std::cin &gt;&gt; op;
        switch (op) {
        case 1:
            bubbleSort();
            break;
        case 2:
            vector = mergeSort(vector);
            break;
        }
    }
public:
    Sorter() = delete;
    Sorter(std::vector&lt;T&gt; vec) : vector(vec) {
        sort();
    }
    Sorter(T* array) {
        int num = count(array);
        for (int i = 0; i &lt; num; i++) {
            this-&gt;vector.push_back(*(array + i));
        }
        sort();
    }
    std::vector&lt;T&gt; getSorted() {
        return vector;
    }
};


The updated version is always available at this link
In the sort() function its currently hardcoded to merge sort which I assume is not intentional. However, if you do allow the user to give an input you should do some error checking. You'll currently get unexpected behaviour if the user enters anything other than 1 or 2.
You should use std::swap rather than implementing your own swap function. Some types can make optimisations over what you've done.
From a design point of view I would argue that c++ is not an inherently object oriented language and that bubblesort and mergesort should be free functions taking a pair of iterators, to allow them to be more easily reused. You've pretty much done this for merge sort already, it uses none of the members of the Sorter class so could just be made a free function.
Your bubble sort implementation is inefficient. It should check if the vector is sorted after each pass, rather than doing the outer loops you could do while(!isSorted(vector)) or similar.
Merge sort has a very big lambda in it for combine. From a readability  point of view I would pull that out into a separate function.
Both mergesort and bubblesort use indices with operator[] to get the elements from the vector. The preferred way to do this in c++ is using iterators, see https://stackoverflow.com/questions/131241/why-use-iterators-instead-of-array-indices
In count() register is deprecated (and strictly is removed since c++17). You should probably avoid using it to improve compatibility.
I would need to think about it more, but I question if while (*(array + i)) in count will always behave as expected. You assume that the array has an end sentinel value that will dereference to null. I don't that's guaranteed. As far as I know there is not an easy way to get the size from a c style array. The normal way to handle this is to require the user to pass in the size as well. 
Update on capacity(). Your use of capacity() in the merge sort is not correct. You should use size() instead. size() tells you the number of elements currently in the vector whereas capacity() tells you how many elements the vector reserved space for internally. i.e. if you insert more than this number of things into the vector it will internally reserve more space and do reallocate all the elements. It's important to note that the capacity can be greater than the number of elements in the vector. In your case it works ok as the constructor with a pair of iterators initialises the capacity equal to the size. However, I don't think this is guaranteed and is complier dependant. To see the difference try the following code:


    std::vector&lt;int&gt; v;
    std::cout &lt;&lt; 0 &lt;&lt; " " &lt;&lt; v.size() &lt;&lt; " " &lt;&lt; v.capacity() &lt;&lt;"\n";
    for( int i = 0; i &lt; 10; ++i)
    {
        v.push_back(i);
        std::cout &lt;&lt; i &lt;&lt; " " &lt;&lt; v.size() &lt;&lt; " " &lt;&lt; v.capacity() &lt;&lt;"\n";
    }

0 0 0
0 1 1
1 2 2
2 3 4
3 4 4
4 5 8
5 6 8
6 7 8
7 8 8
8 9 16
9 10 16