/home/studenter/sajis997/adaptation/lab1/src/bvhaccelerator.cpp:154: error: argument of type ‘bool (asr::BVHAccelerator::)(asr::Intersectable*)’ does not match ‘bool (asr::BVHAccelerator::*)(asr::Intersectable*)’
I hope some one in the forum will help me to find the problem in my code
Deprecated is defined by the IS as: Normative for the current edition of the Standard, but not guaranteed to be part of the Standard in future revisions.
As such, it sends a clear message to programmers: Do not use this feature anymore in any new code that you write. However if you already have legacy code that uses this feature, you have time to fix it: it will continue to work as it did before atleast till the next revision of the standard.
Ideally, programmers would compile their code with warnings enabled and compilers would convey this message to the programmer with a diagnostic. But the mileage varies.
Deprecation of a feature has nothing to do with it not being an 'only C++11 feature'. Almost all of the C++98 features are also non-deprecated C++11 features - std::rand() is not deprecated even though C++11 has <random>; std::pair<> is not deprecated even though C++11 has std::tuple<>.
The following is pure C++98 code. But it contains several constructs that were deprecated by the IS for C++98:
warning: This file includes at least one deprecated or antiquated header
which may be removed without further notice at a future date.
Please use a non-deprecated interface with equivalent functionality instead.
For a listing of replacement headers and interfaces, consult the file backward_warning.h.
To disable this warning use -Wno-deprecated.
warning: deprecated conversion from string constant to 'char*'
warning: deprecated conversion from string constant to 'wchar_t*'
clang also warns about:
warning: incrementing expression of type bool is deprecated
Deprecation of a feature has nothing to do with it not being an 'only C++11 feature'.
Nobody said or implied that it did. Many people are using compilers that don't support features required by C++11 where the corresponding (replaced) pre-C++11 feature is deprecated. So, it doesn't necessarily make sense to recommend them until such features are more widely implemented.
> Many people are using compilers that don't support features required by C++11 where the
> corresponding (replaced) pre-C++11 feature is deprecated.
> So, it doesn't necessarily make sense to recommend them until such features are more widely implemented.
Agreed.
This is C++98-compatible code that uses deprecated features.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <algorithm>
#include <functional>
struct A
{
A( int i = 7 ) : div(i) {}
int div ;
bool divisible( int arg ) const { return arg%div == 0 ; }
};
int main()
{
int seq[] = { 23, 42, 13, 91, 14, 72, 53 } ;
enum { N = sizeof(seq) / sizeof(seq[0]) } ;
A aa ;
std::cout << std::count_if( seq, seq+N,
std::bind1st( std::mem_fun_ref(&A::divisible), aa ) ) << '\n' ;
}
This too is C++98-compatible code with equivalent functionality:
...yes, but at the expense of re-writing the stuff you are avoiding.
Personally, I likestd::function<>; I think it is about time there was a superior solution.
However, it is easy enough to do a simple mass-swap of "mem_fun" to "function" when the time comes.
In the meantime, I'm going to let people's compilers catch up before I start recommending stuff that will confuse the newbies even more than than they already are and require them to do a lot of extra work to figure it out.
> ... confuse the newbies even more than than they already are ..
It is a moot point which of the following two snippets - one that uses deprecated features or the one that does not - will confuse a newbie 'even more'.
I don't think throwing extra confusion into the argument proves your point. The std::replace_copy_if() function is overused simply because they forgot to put copy_if() into the STL the first time around, and it makes everyone's head spin to play with double negatives.
My point is an extremely simple one: a deprecated feature should not be used if it can be avoided. And I would not recommend the use of a deprecated feature to any one.