Jump to content
  • Advertisement

_moagstar_

Member
  • Content Count

    288
  • Joined

  • Last visited

Community Reputation

465 Neutral

About _moagstar_

  • Rank
    Member
  1. _moagstar_

    MacBook Pro Retina Display

    As good as the mac touchpad is (much better than any PC laptop I tried) I still find it an immensly frustrating input device. Wireless mouse all the way for me (prefereably with 2 buttons!)
  2. _moagstar_

    C++ tools that are new to you

    I would certainly agree with this, xerces is lot's of things, but lightweight is not one of them. The one redeming feature of xersec however is xml validation. However if you don't need that then I've found pugixml to be a more lightweight and easy to use alternative.
  3. _moagstar_

    C++ tools that are new to you

    One tool I've found particularly useful is codesynthesis xsd which can be used to transform xml schemas to c++ code for data binding. The main thing I use this for is for defining configuration files, although the use certainly not limited to that. I get xml parsing, validation and c++ representations of schemas for free. This means I can do all kinds of handy things such as automatic documentation generation using an xslt, and also editing the configurations becomes a breeze in a good xml editor (e.g. Visual Studio) which has auto-completion.
  4. Here is a really good introduction http://www.ibm.com/developerworks/library/l-neural/ The python library they use is also great for quickly getting started http://arctrix.com/nas/python/bpnn.py
  5. If you are doing this as part of a static library I would say it's best to still put these function definitions in a seperate header file (or .ipp or .inl whatever takes your fancy) rather in the instantiating cpp (although as Brother Bob points out the extra class definition in your example code is redundant). This file can then be distributed with your normal headers. This way if you don't provide an explcit instantiation for a particular type, client code can still include the appropriate file and instantiate for that type, otherwise client code can only ever use the types you export. // SomeStruct.hpp template <class T> struct SomeStruct { void func(); }; // SomeStruct.ipp template <class T> void SomeStruct<T>::func() { // code } // instantiation.cpp #include "SomeStruct.hpp" template class SomeStruct<int>; template class SomeStruct<double>; // client.cpp #include "SomeStruct.hpp" #include "SomeStruct.ipp" // explicit instantation for double not provided in SomeLib.lib SomeStruct<double> object;
  6. _moagstar_

    C++ compile-time template arg name?

    Unfortunately this won't work... The declaration of a literal operator template shall have an empty parameterdeclaration-clause, and its template-parameter-list shall have a single template parameter that is a non-type template parameter pack with element type char. [/quote] http://www.open-std..../2008/n2765.pdf Even if there was some way of getting the type information into the user defined literal I just tried static_assert with a user defined literal in gcc 4.7 and the error message is empty, which is a shame. Proabably the best (and most portable) solution is to try and word your error message appropriately. That makes sense, since there's no way for the preprocessor to know what the function name will be.
  7. _moagstar_

    C++ compile-time template arg name?

    Which version of gcc are you using? I believe that user defined literals are supported from version 4.7 http://en.cppreference.com/w/cpp/language/user_literal It may be possible to parse the PRETTY_FUNCTION macro to get the text you require. However I havent tried this and am on a train at the moment so cannot test it myself.
  8. What SiCrane said, also note that you need to use a const_iterator since you are passing a const reference : for(typename std::map<char, U>::const_iterator it = values.begin(); it != values.end(); it++)
  9. _moagstar_

    VS 2010 Compiler Crash

    Although it is a bug with the compiler that you don't get an appropriate error here, these messages are usually caused by something wrong in your code. This is the bug in your code: template <class T> class fatalError { public: /* Doing qualified name look-up of a class that is being defined T* fatalError::getObject(int i){ return new T(i); } T *fatalError::getObject(const char *j){ return new T(j); } */ T* getObject(int i){ return new T(i); } T *getObject(const char *j){ return new T(j); } }; This compiles fine with the modifications above. EDIT : Sorry, I missed the "[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][background=rgb(250, 251, 252)]On removing the fatalError:: part within the member function definitions" part[/background] [/font]
  10. _moagstar_

    Favorite rap/hip hop artist

    I'm not really into mainstream hip-hop to be honest but I like rjd2, I find it more melodic than a lot of hip-hop out there: And although perhaps not technically hip-hop cocorosie have a certain something about the 'hip-hop-esque' style :
  11. Everything you think you know is actually composed entirely of varying levels of belief[/quote] And that's my armchair philosophy done for the day.
  12. +1 for the _copy suffix. I would argue that it is the most idiomatic "c++" way of doing things, it's the approach taken by both the standard library and boost. As an example, take a look at the std::string member functions, the name of the function is the operation, and they are all mutating: http://www.cplusplus.com/reference/string/string/replace/ So I would expect the default behaviour of a function to be mutating, unless the name of the function specifies otherwise. I agree that the convenience of the copy version and the fact that it takes next to no work to implement make it worth the while. For some inspiration you might want to take a look at the boost string algorithms: http://www.boost.org/doc/libs/1_48_0/doc/html/string_algo.html
  13. Use shared_ptr where the ownership of the object is shared, and weak_ptr for observers of an object and this should not be an issue.
  14. Assuming you are using C++, you can use some BOOST_PP trickery to do this while retaining type safety: // log.h #include <iostream> #include <boost/preprocessor/library.hpp> #define MAKEARG(z, n, arg) << BOOST_PP_CAT(arg, n) #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, 8, "log_pp.h")) #include BOOST_PP_ITERATE() #undef MAKEARG // log_pp.h template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename T)> inline void log(std::ostream& os, BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), const T, &arg)) { os BOOST_PP_REPEAT(BOOST_PP_ITERATION(), MAKEARG, arg); } // log.cpp #include "log.h" int main(int argc, char* argv[]) { log(std::clog, "this", "is", "a", "test"); return 0; }
  15. _moagstar_

    A planet made of diamonds!

    Even going "extremely fast", At some point you would hit the speed of light, and since nothing can travel faster than the speed of light the minimum amount of time this journey could take is 4000 years. Unless of course you generate or find some kind of wormhole.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!