- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 2
- Posts with Downvotes
- 1
- Downvoting Members
- 2
I found a lot of books introduce about objective C but can't find a book which talk about objective C++.Could you introduce me an objective C++ textbook? I learned C++ before but don't know objective C, where should I start if I want to learn objective C++?Looks like it is … | |
template<typename View> struct pixel_traits; template<> struct pixel_traits<gray8c_view_t> { typedef gray8c_pixel_t type; } Could I find something like this from gil?Thanks | |
Re: [QUOTE]System programming: Learn C and get some basics in assembly.[/QUOTE] c is still dominate the field of system programming so many programmers would reject c++ when refer to system programming. "slow", "code bloat", "waste of memory", "over complicated" and so on Many of those system programmers believe that "c++ must … | |
#ifndef EXAMPLE_HPP #define EXAMPLE_HPP #include <memory> #include <boost/gil/gil_all.hpp> #include <QtGui/QApplication> #include <QtGui/QHBoxLayout> #include <QtGui/QImage> #include <QtGui/QLabel> #include <QtGui/QWidget> //#include "image_details.hpp" static void x_gradient(boost::gil::gray8c_view_t const &src, boost::gil::gray8s_view_t const &dst) { for (int y = 0; y != src.height(); ++y) for (int x = 1; x != src.width() - 1; ++x) dst(x, … | |
Re: you could use smart pointer instead of the raw pointer std::vector<std::auto_ptr<Object> > SpriteList; SpriteList.push_back(new Object); //if your compiler support unique_ptr, you could change auto_ptr to unique_ptr //unique_ptr is a much more better choice than auto_ptr like Scott Meyers said : "handle the resource by object" Besides, according to exceptional c++ … | |
Recently I am studying GIL and concept(htp://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2081.pdf) and encounter a lot of problems. concept ChannelConcept<typename T> : EqualityComparable<T> { typename value_type = T; // use channel_traits<T>::value_type to access it where ChannelValueConcept<value_type>; //tag1 typename reference = T&; // use channel_traits<T>::reference to access it typename pointer = T*; // use channel_traits<T>::pointer to … | |
Re: I don't know C# very well, but I know C, C++(primary language) and using java to develop some app on android(even I don't like the philosophy of java, everything should be object?pointer is too dangerous so we should not use it?you don't have to care about memory and so on).Before … | |
I would like to study the source codes of openCV and reimplement them by the boost generic image library, I hope the algorithms developed by GIL could be integrated with Qt seamlessly. There are many libraries of image processing and I don't need to implement them again if I only … | |
Code blocks are created by indenting at least 4 spaces ... and can span multiple lines class Wizard : public QDialog { Q_OBJECT public: Wizard(QWidget *parent); private slots: void what_ever(); private: QPushButton *what_ever; }; Wizard::Wizard( QWidget *parent ) : QDialog(parent) { QGridLayout *layout = new QGridLayout( this ); QScopedPointer<QTextEdit> textEdit(new … | |
Re: 1 : use 3rd libraries, ex : openCV, CImg 2 : study the format of pgm and encode by yourself example of openCV #include<opencv2\core\core.hpp> #include<opencv2\highgui\highgui.hpp> int main() { cv::Mat img = cv::imread("lena.pgm", -1); cv::imshow("output image", img); cv::waitKey(); return 0; } | |
Re: compile by vc2010, coding style of C++11? [code] #include<algorithm> //for std::for_each, std::reverse and std::copy #include<array> //for std::array #include<iostream> //for std::cout, std::cin.get #include<iterator> //for std::ostream_iterator #include<string> template<typename T> void reverseString(T &value) { std::for_each(value.begin(), value.end(), [](std::string &fir) { std::reverse(fir.begin(), fir.end()); }); } int main() { std::array<std::string, 3> value = {"one", "two", "three"}; … | |
Re: Your codes are not bad, but there are still something could be refine [code] //this is not initialize but assignment Player::Player(int MyID, string MyFactionName) { ID=MyID; FactionName=MyFactionName; } [/code] [code] //This is initialize Player::Player(int MyID, string MyFactionName) :ID(MyID), FactionName(MyFactionName){ } [/code] [code] //you are intent to copy the string, use … | |
I saw the movie from the link[URL="http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Keynote-Bjarne-Stroustrup-Cpp11-Style"]http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Keynote-Bjarne-Stroustrup-Cpp11-Style[/URL] Could I find something like std::async from boost?Thanks a lot | |
Could I find some translator which could translate partial C++ codes to equivalent C codes? like [code] int max(int A, int B); double max(double B, double B); [/code] would be translate to something like [code] int maxInt(int A, int B); double maxDouble(double B, double B); [/code] [code] template<typename T = … | |
I am studying the source codes of SGI STL and have many problems with it. I can't figure out the design choice of the iterator of SGI STL as follow [code] template <class _Tp, class _Ref, class _Ptr> struct _Slist_iterator : public _Slist_iterator_base { typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator; #1 … | |
I discover a performance pitfall of vc2010, I compile it by release mode(O2).The results are pretty unacceptable at the first time. [code] #include<ctime> #include<iostream> /* * This is a small performance pitfall I discover from vc2010, * for simplicity, I didn't separate the header file and source file. * At … | |
When I was a student, I believe that most of the software programmers of every software companies must be very talented, brilliant, skillful and much more experience than me, at least before I got my first job, I really believe that every software companies could let me learn a lot.But … | |
I am trying to write some simple programs related to network and I boost::asio as a tool to start with Below is one of the example from a blog(I alter it a little bit) [code] void OnConnect(const boost::system::error_code & ec) {} void asio_7b() { asio::io_service io_service; asio::ip::tcp::socket sock(std::ref(io_service) ); try … | |
[code] struct String { String() { std::cout<<"String::String(), this="<<this<<std::endl; } ~String() { std::cout<<"String::~String(), this="<<this<<std::endl; } String(String const &other) { std::cout<<"String::String(String const &other), this="<<this; std::cout<<", other="<<&other<<std::endl; } String& operator=(String const &other) { std::cout<<"String::operator=(String const &other), this="<<this; std::cout<<", other="<<&other<<std::endl; return *this; } }; String const operator*(String const &lhs, String const &rhs) { String … | |
I need to make the last 5 bits of the unsigned int become zero(1111_1111 to 1110_0000) There are two solution [code] unsigned int number = 0xFFFF; unsigned int temp_one = number & (~0x1F); unsigned int temp_two = number >> 5 << 5; [/code] which one is faster? I write a … | |
compiler : visual c++ 2005 os : win7 64bits The more I study about our source codes, the more dense fogs surround my head. According to what I know, memset can't be used to initialize POD This is the snippet of our codes(The problem of encapsulation? there are too many … | |
If this is not a right place to post this article, please move it to another way, thank you very much. Sometimes(or always) giving a name to a class or variable is not an easy job, I want to make it expressive and short, how do you solve this kind … | |
Re: [QUOTE=;][/QUOTE] [quote]Here's a link to a read me thread in the Computer Science forum [/quote] The opinions are pretty good, but there are some things about C++ I don't agree with. >C++ is an Object Oriented Programming (or OOP) C++ is an multi-paradigms language >Programs can be slightly larger and … | |
I don't know should I post this article at here or not, if you think this should belongs to other area, please move it to there. I need to design some domain specific language to generate some C++ source codes. I have considered about using xml directly instead of designing … | |
[code] #include<iostream> #include<string> #include<vector> #include<boost/spirit/include/phoenix.hpp> #include<boost/spirit/include/karma.hpp> struct test_spirit { void read_function(std::string &result, std::string const &val) const { if(result != "memo_zero") result += val; } }; void spirit_01b() { std::vector<std::string> data; data.push_back("memo_zero"); data.push_back("memo_two"); data.push_back("memo_three"); std::string temp; test_spirit ts; karma::generate ( std::back_inserter(temp), ( karma::string[phoenix::bind(&test_spirit::read_function, &ts, karma::_1, karma::_val)] << ", " ), data, … | |
I would like to generate output like this common, int, optional video, double, optional by karma with the structure [code] struct attr_struct { std::vector<std::string> name; std::vector<std::string> type; std::vector<std::string> use; }; [/code] So I defined some rules for it [code] #include<iostream> #include<string> #include<vector> #include<boost/fusion/adapted/struct.hpp> #include<boost/spirit/include/karma.hpp> namespace karma = boost::spirit::karma; namespace karma … | |
I take some codes from [url]http://boost-spirit.com/home/articles/karma-examples/output-generation-from-a-list-of-key-value-pairs-using-spirit-karma/[/url] But it wouldn't compile My compiler : vc++ 2010 os : win7 64bits [code] #include<iostream> #include<string> #include<boost/optional.hpp> #include<boost/spirit/include/karma.hpp> namespace karma = boost::spirit::karma; namespace phoenix = boost::phoenix; int main() { typedef std::back_insert_iterator<std::string> sink_type; karma::rule<sink_type, std::string()> base = karma::string; typedef std::pair<std::string, boost::optional<std::string> > pair_type; karma::rule<sink_type, pair_type()> … | |
[code] void airplaneTest::SetUp() { ASSERT_TRUE(this->msg_handler_.install_airplane(GetParam()) << "Failed to install airplane " << GetParam(); airplane_id_ = airplane.airplane_id(); } void airplaneTest::TearDown() { ASSERT_FALSE(airplane_id_.empty() ); ASSERT_TRUE(this->msg_handler_.remove_airplane(airplane_id_)) << "Failed to remove airplane " << GetParam(); } //a lot of test case put into TEST_P [/code] Google test will reinstall the airplane for diffrent test … | |
Now I have a lot of airplanes, in the ideal world the interface of the airplanes(or anything) should be unify but for some kind of weird reasons, the class for different airplanes are designed like this [code] struct airplane_A { fly_A(); speed_up_A(); //blah blah blah }; struct airplane_B { fly_B(); … |