Useless C++ features

Hey guys! What C++ features are useless? What C++ features that you love, like or dislike?
I don't think anybody is seriously using std::rel_ops. Overloading of operator->*() is pretty rare too.

Nothing is really useless, though - C++ always had the policy of only adding features that are used by at least two unrelated people (which is why it's near impossible to truly deprecate anything. They want to remove operator++ for bools by 2014, and companies complain that it breaks their codebases)
Last edited on
I think that templates can be simplified for external declaration, but it will probrably not happen unless they change the next standard for example:
normally people inline it within the class:
1
2
3
4
5
6
7
template <typename t> class SomeClass
{
     int SomeFunction()
    {
        return 0;
    }
};

but when you declare the prototype inside the class then the implementation out side of the class it gets clunky, (this might be wrong):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
template <typename t> class SomeClass
{
     int SomeFunction();
};

//explicit
template <typename t>
int SomeClass<t>::SomeFunction()
{

}

//rather than implicitly, eliminate the fat

int SomeClass<typename t>::SomeFunction()
{

}


and for the constructor it gets confusing
Last edited on
closed account (o1vk4iN6)
1
2
3
4
5
6
7
8
9
10
11
12
class t { };

template<>
int SomeClass< typename t >::SomeFunction()
{
}

// ambiguous
int SomeClass< typename t >::SomeFunction()
{
}


There is a lot to consider when making a change.
Trigraph and digraph sequences. I don't think anyone uses them.
The comma operator is pretty much useless. Not for argument passing, but its usage in expressions.
@Disch, comma is kind of useful in for(i = 0, j = 50; i < j; i++, j--).
touche
The std library :D
@masterofpuppets690
What should we use instead?
My custom library that does everything with preprocessor macros and there are no objects :D I was very much joking Peter :)
Did you know C has a typeof extension...

1
2
3
4
#define swap(a, b) do {\
    __typeof__ (a) temp;\
    temp = a; a = b; b = temp;\
} while (0) 


so your joke may become someone's agony...
Out of interest, is __typeof__ actually part of C? Or is it a GCC extension?
typeof or __typeof__ is a common compiler extension to C. It is supported by GCC, Clang, Intel C, Sun Studio (as of version 12), IBM XLC, and quite likely others.
Last edited on
Topic archived. No new replies allowed.