小编fra*_*ees的帖子

Sass和组合子选择器

我刚刚发现了Sass,我对此非常兴奋.

在我的网站中,我实现了一个树状导航菜单,使用子组合器(E > F)进行样式设置.

有没有办法用Sass中更简单(或更好)的语法重写这段代码?

#foo > ul > li > ul > li > a {
  color: red;
}
Run Code Online (Sandbox Code Playgroud)

css sass css-selectors

119
推荐指数
2
解决办法
12万
查看次数

游戏引擎上的FRP.这值得么?

今天,我读到了有关FRP(功能反应式编程)的内容.但是,我不知道这适合发动机本身.

阅读Gerold Meisinger的文章后,我的问题是,如果使用FRP而不是基于组件的架构是值得的.这是游戏引擎架构设计的不久的将来吗?这只是解决基于组件的架构的小问题的一种简单方法吗?我很欣赏任何文章,解释,个人意见等.

想想商业游戏的引擎,特别是射击游戏或赛车类型(3D游戏).不要考虑2D平台或其他更简单(谈论引擎复杂性)的平台.我使用C/C++(我注意到使用FRP的人依赖于Haskell,因为它的性质.但是,我看到这个文档并且更喜欢站在C++上,作为"行业标准").

c++ architecture components game-engine frp

18
推荐指数
1
解决办法
7800
查看次数

调用'erase'没有匹配的成员函数

这是导致错误的代码:

Factory.h:

#include <string>
#include <map>

namespace BaseSubsystems
{
    template <class T>
    class CFactory
    {
    protected:
        typedef T (*FunctionPointer)();
        typedef std::pair<std::string,FunctionPointer> TStringFunctionPointerPair;
        typedef std::map<std::string,FunctionPointer> TFunctionPointerMap;
        TFunctionPointerMap _table;
    public:
        CFactory () {}
        virtual ~CFactory();
    }; // class CFactory

    template <class T> 
    inline CFactory<T>::~CFactory()
    {
        TFunctionPointerMap::const_iterator it = _table.begin();
        TFunctionPointerMap::const_iterator it2;

        while( it != _table.end() )
        {
            it2 = it;
            it++;
            _table.erase(it2);
        }

    } // ~CFactory
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误:

error: no matching member function for call to 'erase' [3]
                         _table.erase(it2);
                         ~~~~~~~^~~~~
Run Code Online (Sandbox Code Playgroud)

有小费吗?谢谢.

c++ templates factory

8
推荐指数
1
解决办法
1万
查看次数

用Ruby读取选择性文件

我有一个巨大的文件,看起来像这样:

7

bla1
blala
blabla
blab
blals
blable
bla

more here..
Run Code Online (Sandbox Code Playgroud)

第一个数字表示我将拥有多少个值.问题是,我只想直接指向第11行(文本"更多这里......"),而不必先阅读所有这些值.在我的情况下,我有大量的数字,所以必须进行优化.

你能推荐一下吗?

ruby seek

3
推荐指数
1
解决办法
3836
查看次数